Example #1
0
def user_interceptor(next):
    logging.info("Trying to retrieve info from SESSION cookie...")
    user = None
    usrext = None
    cookie = ctx.request.cookies.get(_COOKIE_NAME)
    if cookie:
        logging.info("Cookie found. Trying to parse data...")
        user = parse_signed_cookie(cookie)
        if user:
            logging.info("Login as <%s>..." % user.t_emailaddr)
            usrext = UserExt.find_first("where t_uid=?", user.t_uid)
    ctx.request.user = user
    ctx.request.usrext = usrext
    return next()
Example #2
0
def view_user_info(userid):
    u = User.get(userid)
    u_ext = UserExt.get(userid)
    if u is None:
        raise NotFound()
    return dict(user=ctx.request.user, u=u, ext=u_ext)