def post(self, key): viewed_user = ndb.Key(urlsafe=key).get() if self.request.get('delete') == 'delete': viewed_user.key.delete() self.redirect('/users') return viewed_user.name = self.request.get('name') or 'Unknown' viewed_user.email = self.request.get('email') viewed_user.level = integers.to_integer(self.request.get('level'), 1) if not EMAIL_REGEX.match(viewed_user.email): template.send( self, 'user.html', { 'title': 'User: '******'viewed_user': viewed_user, 'message': 'Please enter a valid email address.' }) return viewed_user.put() template.send(self, 'user.html', { 'title': 'User: '******'viewed_user': viewed_user })
def post(self, key): viewed_user = ndb.Key(urlsafe=key).get() if self.request.get('delete') == 'delete': viewed_user.key.delete() self.redirect('/users') return viewed_user.name = self.request.get('name') or 'Unknown' viewed_user.email = self.request.get('email') viewed_user.level = integers.to_integer(self.request.get('level'), 1) if not EMAIL_REGEX.match(viewed_user.email): template.send(self, 'user.html', { 'title': 'User: '******'viewed_user': viewed_user, 'message': 'Please enter a valid email address.' }) return viewed_user.put() template.send(self, 'user.html', { 'title': 'User: '******'viewed_user': viewed_user })
def get(self): template.send(self, 'user.html', { 'title': 'New User', 'viewed_user': { 'new': True } })
def get(self, serial_number): try: values = spreadsheets.get_values( 'Database!A2:A', service, decorator ) blazer = None for i, row in enumerate(values): if not blazer and row[0] == serial_number: blazer_row = i + 2 blazer_range = 'A%d:H%d' % (blazer_row, blazer_row) blazer_data = spreadsheets.get_values( blazer_range, service, decorator, defaultValue=None ) if blazer_data: blazer = create_blazer(blazer_data[0]) template.send(self, 'blazer.html', { 'title': 'Blazer: ' + serial_number, 'blazer': blazer }) except client.AccessTokenRefreshError: self.redirect('/')
def get(self): curr_user = user.get_user() loginUrl, logoutUrl = user.create_login_urls(self.request.path) if not curr_user: # exit early if logged out template.send(self, 'logout.html', { 'title': 'Home', 'loginUrl': loginUrl, 'user': None }) return template.send(self, 'home.html', {'title': 'Home'})
def get(self): curr_user = user.get_user() loginUrl, logoutUrl = user.create_login_urls(self.request.path) if not curr_user: # exit early if logged out template.send(self, 'logout.html', { 'title': 'Home', 'loginUrl': loginUrl, 'user': None }) return template.send(self, 'home.html', { 'title': 'Home' })
def get(self): try: values = spreadsheets.get_values('Database!A2:D', service, decorator) blazers = [] for row in values: if row[3] == 'Yes': blazers.append(create_blazer(row)) template.send(self, 'listings.html', { 'title': 'Loaned Blazers', 'blazers': blazers }) except client.AccessTokenRefreshError: self.redirect('/')
def get(self): events_query = ARCHIVES_QUERY.bind(date.get_date()) cursor = Cursor(urlsafe=self.request.get('cursor')) events, next_cursor, more = events_query.fetch_page(25, start_cursor=cursor) next_link = None if more and next_cursor: next_link = next_cursor.urlsafe() template.send(self, 'events.html', { 'title': 'Archives', 'events': events, 'url': 'archives', 'next': next_link })
def get(self): try: values = spreadsheets.get_values( 'Database!A2:D', service, decorator ) blazers = [] for row in values: if row[3] == 'Yes': blazers.append(create_blazer(row)) template.send(self, 'listings.html', { 'title': 'Loaned Blazers', 'blazers': blazers }) except client.AccessTokenRefreshError: self.redirect('/')
def post(self): info = { 'name': self.request.get('name') or 'Unknown', 'email': self.request.get('email'), 'level': integers.to_integer(self.request.get('level'), 1) } if not EMAIL_REGEX.match(info['email']): info['new'] = True template.send(self, 'user.html', { 'title': 'New User', 'viewed_user': info, 'message': 'Please enter a valid email address.' }) return key = User(**info).put() self.redirect('/users/' + key.urlsafe())
def post(self): info = { 'name': self.request.get('name') or 'Unknown', 'email': self.request.get('email'), 'level': integers.to_integer(self.request.get('level'), 1) } if not EMAIL_REGEX.match(info['email']): info['new'] = True template.send( self, 'user.html', { 'title': 'New User', 'viewed_user': info, 'message': 'Please enter a valid email address.' }) return key = User(**info).put() self.redirect('/users/' + key.urlsafe())
def get(self, serial_number): try: values = spreadsheets.get_values('Database!A2:A', service, decorator) blazer = None for i, row in enumerate(values): if not blazer and row[0] == serial_number: blazer_row = i + 2 blazer_range = 'A%d:H%d' % (blazer_row, blazer_row) blazer_data = spreadsheets.get_values(blazer_range, service, decorator, defaultValue=None) if blazer_data: blazer = create_blazer(blazer_data[0]) template.send(self, 'blazer.html', { 'title': 'Blazer: ' + serial_number, 'blazer': blazer }) except client.AccessTokenRefreshError: self.redirect('/')
def get(self): curr_user = user.get_user() if not curr_user: # exit early if logged out template.send(self, 'logout.html', {'title': 'Home', 'user': None}) return elif curr_user.level == 0: # not a vjc email template.send(self, 'logout.html', {'title': 'Unauthorised'}) else: template.send(self, 'home.html', {'title': 'Home'})
def get(self): template.send(self, 'users.html', { 'title': 'Users', 'users': USERS_QUERY.fetch(), })
def get(self, key): viewed_user = ndb.Key(urlsafe=key).get() template.send(self, 'user.html', { 'title': 'User: '******'viewed_user': viewed_user })
def get(self, key): event = ndb.Key(urlsafe=key).get() template.send(self, 'event.html', { 'title': 'Event: ' + event.name, 'event': event })