def queryAge(aid): try: intid = int(aid) age = dict(db.where('ages', id=aid)[0]) except: age = dict(db.where('ages', shortname=aid)[0]) age['author'] = userdb.queryUser(age['creator']) age['author']['uri'] = config.users_path + '/' + str(age['creator']) # Once the author dict is filled, creator is redundant, and not part of # the public API del age['creator'] return age
def queryAge(aid): try: intid = int(aid) age = dict(db.where('ages', id=aid)[0]) except: age = dict(db.where('ages', shortname=aid)[0]) age['author'] = userdb.queryUser(age['creator']) age['author']['uri'] = config.users_path+'/'+str(age['creator']) # Once the author dict is filled, creator is redundant, and not part of # the public API del age['creator'] return age
def GET(self, uid): try: return userdb.queryUser(uid) except IndexError: raise web.NotFound("The requested user does not exist")