def render_template(self, template, **kw):
        """ Renders a template or creates a json response if needed """
        if self.request.path.endswith("/json"):
            return self.json_out(kw, 200)
        if self.request.path.endswith("/xml"):
            return self.xml_out(kw, 200)

        kw["user_info"] = self.user_info
        # check if there is a state in the session and store a new one if not
        if not session.get("state"):
            session["state"] = utils.make_csrf_state(30)
        kw["state"] = session["state"]
        return render_template(template, **kw)
    def render_template(self, template, **kw):
        ''' Renders a template or creates a json response if needed '''
        if self.request.path.endswith("/json"):
            return self.json_out(kw, 200)
        if self.request.path.endswith("/xml"):
            return self.xml_out(kw, 200)

        kw['user_info'] = self.user_info
        # check if there is a state in the session and store a new one if not
        if not session.get("state"):
            session['state'] = utils.make_csrf_state(30)
        kw['state'] = session['state']
        return render_template(template, **kw)
Пример #3
0
 def get(self):
     # make a new state just in case.
     session['state'] = utils.make_csrf_state(32)
     return self.render_template("login.html")