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."))
def welcome(req): message = _("Welcome!") return Response('<h1>%s</h1>' % message)
def hello_view(req): # NOTE: This is a translation comment. message = _("Hello World") return Response('<h1>%s</h1>' % message)