Beispiel #1
0
        def decorate(self, req, *args, **kwargs):
            if '_ajax_token' not in req.form or \
               'security.ajax_token' not in req.session or \
               req.form['_ajax_token'] != req.session['security.ajax_token']:
                try:
                    log.debug("Expected: %r, got %r.",
                              req.session['security.ajax_token'],
                              req.form['_ajax_token'])
                except KeyError, err:
                    log.warn("Encountered key error while retrieving ajax"
                              "debug information. Probably broken session.")

                raise JSONException(_("Invalid AJAX token!"
                                      " Please reload this page."))
Beispiel #2
0
def welcome(req):
    message = _("Welcome!")
    return Response('<h1>%s</h1>' % message)
Beispiel #3
0
def hello_view(req):
    # NOTE: This is a translation comment.
    message = _("Hello World")
    return Response('<h1>%s</h1>' % message)