コード例 #1
0
    def render_template(self, template_name, template_values):
        template_values['App'] = App
        template_values['None'] = None
        template_values['points'] = None
        template_values['username'] = ""

        user = util.get_current_user()
        if user is not None:
            template_values['username'] = user.nickname()

        user_data = UserData.get_for(user)

        template_values['user_data'] = user_data
        template_values['points'] = user_data.points if user_data else 0

        if not template_values.has_key('continue'):
            template_values['continue'] = self.request.uri

        # Always insert a post-login request before our continue url
        template_values['continue'] = util.create_post_login_url(template_values['continue'])

        template_values['login_url'] = ('%s&direct=1' % util.create_login_url(template_values['continue']))
        template_values['logout_url'] = util.create_logout_url(self.request.uri)

        template_values['is_mobile'] = self.is_mobile()

        path = os.path.join(os.path.dirname(__file__), template_name)
        self.response.out.write(template.render(path, template_values))
コード例 #2
0
ファイル: login.py プロジェクト: PaulWagener/khan-website
    def request_continue_url(self, key="continue", default="/"):
        cont = super(Login, self).request_continue_url(key, default)

        # Always go to /postlogin after a /login, regardless if the continue
        # url actually specified it or not. Important things happen there.
        return util.create_post_login_url(cont)
コード例 #3
0
ファイル: login.py プロジェクト: derekzhang79/khan-website
    def request_continue_url(self, key="continue", default="/"):
        cont = super(Login, self).request_continue_url(key, default)

        # Always go to /postlogin after a /login, regardless if the continue
        # url actually specified it or not. Important things happen there.
        return util.create_post_login_url(cont)