def GET(self): q = web.input() t = template.env.get_template('search.html') f = search_form() try: if q.query: results = [] user_list = [] query = q.query.split(' ') for i in User.all(): x = util.strip_private_data(i) if x is not None: user_list.append(x) for p in user_list: for i in query: if i in dict(p).values(): results.append(p) return t.render(util.data( title='Find who you\'re looking for!', form=f, results=results if results else None, )) else: web.debug('q.query doesn\'t exist and it didn\'t thow an exception!') raise Warning('Odd, huh?') except: return t.render(util.data( title='Find who you\'re looking for!', form=f, ))
def GET(self, user_id): t = template.env.get_template("profile.html") if user_id.lower() == "us": user_info = { "nickname": "Mr. Roboto", "first_name": "The", "middle_name": "Connection", "last_name": "Machine", "city": "Google App Engine", "state": "The Internet", } else: try: e = util.get_user(user_id=user_id.lower()) user_info = util.strip_private_data(e) except AttributeError: user_info = { "nickname": "[deleted]", "first_name": "No", "middle_name": "such", "last_name": "user", "city": "reddit.com", "state": "The Internet", } return t.render(util.data(info=user_info, user_id=user_id))
def GET(self, name): t = template.env.get_template('user_list.html') list_list = [ # list_list should be generated somehow 'global', 'Lists all users from all locales.', ] user_list = [] if (name is None): return t.render(util.data( title='User Lists', instructions='''Users are grouped into "user lists" that group them geographically. These lists are automatically generated and will change based upon the relative size of various user populations.''', list_list=map( lambda (li): {'name': li[0], 'scope': li[1]}, zip(*[list_list[i::2] for i in range(2)]), ), )) elif (name.lower() in list_list[::2]): for i in User.all(): x = util.strip_private_data(i) if x is not None: user_list.append(x) else: raise web.notfound() return t.render(util.data( title='Display all members', instructions='''Public member listing''', users=user_list, ))