Esempio n. 1
0
    def get(self):

        user = users.get_current_user()
        #checks to see if we have a user signed in
        if user:
            userProfile = User.getByEmail(user.email())
            #if user profile is empty create one
            if not userProfile:
                userProfile = User()
                userProfile.email = user.email()
                userProfile.nickname = 'Anonymous'
                userProfile.score = 0
                userProfile.played = 0
                userProfile.put()

            template_values = {
                'user': userProfile
            }

            template = jinja_environment.get_template('profile.html')
            self.response.out.write(template.render(template_values))
        #if not is ask them to sign in
        else:
            template_values = {
                'signinurl' : users.create_login_url("/")
            }

            template = jinja_environment.get_template('signin.html')
            self.response.out.write(template.render(template_values))
Esempio n. 2
0
 def post(self):
     user = users.get_current_user()
     #checks to see if we have a user signed in
     if user:
         userProfile = User.getByEmail(user.email())
         #if user profile is empty create one
         userProfile.nickname = self.request.get("nickname")
         userProfile.put()