i have app engine project storing user's email address , specific redirect url user in datastore.
what want set redirect destination of login based on user logging in.
q = photos.all() q.filter("email =", users.get_current_user().email()) q = db.gqlquery("select * photos " + "where email = :1 ", users.get_current_user().email()) p in q.run():
the variable p.redirect
gives me url want specific user redirected to.
below have tried not working because user hasn't logged in yet receive following error attributeerror: 'nonetype' object has no attribute 'email'
user = users.get_current_user() if user: # user signed in else: # user not signed in q = photos.all() q.filter("email =", users.get_current_user().email()) q = db.gqlquery("select * photos " + "where email = :1 ", users.get_current_user().email()) p in q.run(): url = users.create_login_url(p.redirect) template_values = { 'url': url, }
any appreciated. i've been working python & app engine couple of days may missing obvious.
mark resource (example: /photos) login:required in app.yaml. appengine redirect user login page , once completes login come resource (/photos) , @ time have email current user.
Comments
Post a Comment