コード例 #1
0
 def skills(self,char):
     if UserSession().isLogged() and char!= 'stub':
         user = UserSession().getUser()
         char = models.Char.get_or_insert(str(user.key())+char, owner=user)
         skills= char.skills.fetch(1000)
         self.response.out.write(blocks.render_template('ajax/skills.html', {'skills':skills}))
     else:
         self.response.out.write(blocks.render_template('ajax/skills.html', {'skills':[]}))
コード例 #2
0
 def main(self,char):
     if UserSession().isLogged() and char!= 'stub':
         user = UserSession().getUser()
         char = models.Char.get_or_insert(str(user.key())+char, owner=user)
         charStats = models.CharStats.get_or_insert(char.key().name(), char=char)
         self.response.out.write(blocks.render_template('ajax/main.html', {'charStats':charStats}))
     else:
         self.response.out.write(blocks.render_template('ajax/main.html', {'charStats':models.CharStats()}))
コード例 #3
0
    def journal(self,char):
        if UserSession().isLogged() and char!= 'stub':
            user = UserSession().getUser()
            char = models.Char.get_or_insert(str(user.key())+char, owner=user)
            journal = models.CharJournal.get_or_insert(char.key().name(), char=char)
            self.response.out.write(blocks.render_template('ajax/journal.html', {'journal':journal}))
        else:

            self.response.out.write(blocks.render_template('ajax/journal.html', {'journal':models.CharJournal()}))
コード例 #4
0
    def post(self):
        email = self.request.get("email")
        password = self.request.get("password")

        user = models.User.gql("WHERE email = :1", email).get()
        if user:
            if len(password)>0 and user.password == password:
                UserSession().setUserAsLogged(user)
                self.response.out.write(blocks.render_template('login.xml', {'user_key':user.key()}))
            else:
                self.response.out.write(blocks.render_template('error.xml', {'message':'Wrong password'}))
        else:
            self.response.out.write(blocks.render_template('error.xml', {'message':'User not found'}))
コード例 #5
0
    def get(self):

        userSession = UserSession()

        if userSession.isLogged():
            chars = userSession.getUser().chars
            Registry().set('chars',chars)
        else:
            Registry().set('chars',[])
        Registry().set('user',userSession.getUser())
        Registry().set('sess_id',userSession.getSessId())

        self.response.out.write(blocks.render_template('home.html'))
コード例 #6
0
 def get(self):
     if UserSession().isLogged():
         self.redirect('/');
     else:
         self.response.out.write(blocks.render_template('login/form.html', {}))