Example #1
0
 def get(self):
   user = users.get_current_user()
   logout_url = users.create_logout_url(self.request.uri)
   login_url = users.create_login_url(self.request.uri) # raise NotAllowedError
   profile=''
   if user:
     profile = Profile.query(Profile.user_id==user.user_id())
     if profile.count() <= 0:
       profile = Profile()
       profile.user_id = user.user_id()
       profile.email = user.email()
       profile.firstname = user.nickname()
       profile_key = profile.put()
     else:
       profile_key = Profile.query(Profile.user_id==user.user_id())
     profile = profile_key.get()
     current_user = '******'+ user.nickname()
     user_url = logout_url
     title = "Click to logout from Google."
   else:
     current_user = '******'
     user_url = login_url 
     title = "Click to sign in with your Google Account."
   values = {
     'current_user' : current_user,
     'user_url' : user_url,
     'profile' : profile,
   }
   self.render_html('index.html',values)