aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/meddleware
diff options
context:
space:
mode:
authorSebastian Spaeth <Sebastian@SSpaeth.de>2013-01-14 16:09:24 +0100
committerSebastian Spaeth <Sebastian@SSpaeth.de>2013-01-14 16:09:24 +0100
commit947c08ae43914184116995b2d51f11778497a2be (patch)
tree0f22fd5bd9e0c1c9b76291e5dee089e1d6804760 /mediagoblin/meddleware
parent56cf9f5ff177f1cf2b7686a7625727a1f15bebc1 (diff)
downloadmediagoblin-947c08ae43914184116995b2d51f11778497a2be.tar.lz
mediagoblin-947c08ae43914184116995b2d51f11778497a2be.tar.xz
mediagoblin-947c08ae43914184116995b2d51f11778497a2be.zip
Improve error message wording (#564)
Improve error message wording if no csf cookie could be detected. Also, make the error text translatable.
Diffstat (limited to 'mediagoblin/meddleware')
-rw-r--r--mediagoblin/meddleware/csrf.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/mediagoblin/meddleware/csrf.py b/mediagoblin/meddleware/csrf.py
index 2984ebb9..661f0ba2 100644
--- a/mediagoblin/meddleware/csrf.py
+++ b/mediagoblin/meddleware/csrf.py
@@ -22,6 +22,7 @@ from wtforms import Form, HiddenField, validators
from mediagoblin import mg_globals
from mediagoblin.meddleware import BaseMeddleware
+from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
_log = logging.getLogger(__name__)
@@ -127,10 +128,13 @@ class CsrfMeddleware(BaseMeddleware):
None)
if cookie_token is None:
- # the CSRF cookie must be present in the request
- errstr = 'CSRF cookie not present'
- _log.error(errstr)
- raise Forbidden(errstr)
+ # the CSRF cookie must be present in the request, if not a
+ # cookie blocker might be in action (in the best case)
+ _log.error('CSRF cookie not present')
+ raise Forbidden(_('CSRF cookie not present. This is most likely '
+ 'the result of a cookie blocker or somesuch.<br/>'
+ 'Make sure to permit the settings of cookies for '
+ 'this domain.'))
# get the form token and confirm it matches
form = CsrfForm(request.form)