summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2015-08-31 10:03:56 -0500
committerMichael Merickel <michael@merickel.org>2015-08-31 10:03:56 -0500
commit5aaecd1395dddc6f2e27f904cf759497d63f7eaf (patch)
treeaec80a79373215ffce3aad3b60dc6c2782581d62
parent45de86a44ff1a312720304504e49e6fdc219b9cd (diff)
parent88fcdc4e6a48f2646488565fbafd050f8e298ffa (diff)
downloadpyramid-5aaecd1395dddc6f2e27f904cf759497d63f7eaf.tar.gz
pyramid-5aaecd1395dddc6f2e27f904cf759497d63f7eaf.tar.bz2
pyramid-5aaecd1395dddc6f2e27f904cf759497d63f7eaf.zip
Merge branch 'fixes/HTTPMove' of bertjwregeer/pyramid into pull.1865
-rw-r--r--pyramid/httpexceptions.py11
-rw-r--r--pyramid/tests/test_httpexceptions.py4
2 files changed, 11 insertions, 4 deletions
diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py
index 93d06e0d6..8bf9a0a72 100644
--- a/pyramid/httpexceptions.py
+++ b/pyramid/httpexceptions.py
@@ -160,6 +160,13 @@ class HTTPException(Response, Exception):
# title = 'OK'
# explanation = 'why this happens'
# body_template_obj = Template('response template')
+ #
+ # This class itself uses the error code "520" with the error message/title
+ # of "Unknown Error". This is not an RFC standard, however it is
+ # implemented in practice. Sub-classes should be overriding the default
+ # values and 520 should not be seen in the wild from Pyramid applications.
+ # Due to changes in WebOb, a code of "None" is not valid, and WebOb due to
+ # more strict error checking rejects it now.
# differences from webob.exc.WSGIHTTPException:
#
@@ -178,8 +185,8 @@ class HTTPException(Response, Exception):
#
# - documentation improvements (Pyramid-specific docstrings where necessary)
#
- code = None
- title = None
+ code = 520
+ title = 'Unknown Error'
explanation = ''
body_template_obj = Template('''\
${explanation}${br}${br}
diff --git a/pyramid/tests/test_httpexceptions.py b/pyramid/tests/test_httpexceptions.py
index c700dc80e..b94ef30e4 100644
--- a/pyramid/tests/test_httpexceptions.py
+++ b/pyramid/tests/test_httpexceptions.py
@@ -120,7 +120,7 @@ class TestHTTPException(unittest.TestCase):
def test_ctor_calls_Response_ctor(self):
exc = self._makeOne('message')
- self.assertEqual(exc.status, 'None None')
+ self.assertEqual(exc.status, '520 Unknown Error')
def test_ctor_extends_headers(self):
exc = self._makeOne(headers=[('X-Foo', 'foo')])
@@ -329,7 +329,7 @@ class Test_HTTPMove(unittest.TestCase):
start_response = DummyStartResponse()
app_iter = exc(environ, start_response)
self.assertEqual(app_iter[0],
- (b'None None\n\nThe resource has been moved to foo; '
+ (b'520 Unknown Error\n\nThe resource has been moved to foo; '
b'you should be redirected automatically.\n\n'))
class TestHTTPForbidden(unittest.TestCase):