Make webob.exc.HTTPForbidden return correct message

Currently HTTPForbidden is using wrong parameter 'detail'
somewhere, while the correct parameter should be 'explanation'.
This patch fixes this bug.

Change-Id: I69bc3249f88e9cbf9add954571c21b07cf58f7c6
Closes-Bug: #1283872
This commit is contained in:
Haiwei Xu 2014-02-24 19:17:54 +09:00
parent b63e2f4143
commit 06ec3d6231
2 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ class Lockout(wsgi.Middleware):
failures = int(self.mc.get(failures_key) or 0)
if failures >= CONF.lockout_attempts:
detail = _("Too many failed authentications.")
raise webob.exc.HTTPForbidden(detail=detail)
raise webob.exc.HTTPForbidden(explanation=detail)
res = req.get_response(self.application)
if res.status_int == 403:
failures = self.mc.incr(failures_key)
@ -303,7 +303,7 @@ class Requestify(wsgi.Middleware):
if expired:
msg = _("Timestamp failed validation.")
LOG.exception(msg)
raise webob.exc.HTTPForbidden(detail=msg)
raise webob.exc.HTTPForbidden(explanation=msg)
# Raise KeyError if omitted
action = req.params['Action']

View File

@ -285,7 +285,7 @@ class Application(object):
res = 'message\n'
# Option 2: a nicely formatted HTTP exception page
res = exc.HTTPForbidden(detail='Nice try')
res = exc.HTTPForbidden(explanation='Nice try')
# Option 3: a webob Response object (in case you need to play with
# headers, or you want to be treated like an iterable, or or or)