diff options
| -rw-r--r-- | CHANGES.txt | 5 | ||||
| -rw-r--r-- | docs/narr/scaffolding.rst | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/authentication.rst | 3 | ||||
| -rw-r--r-- | docs/quick_tutorial/authorization.rst | 3 | ||||
| -rw-r--r-- | docs/quick_tutorial/more_view_classes.rst | 2 | ||||
| -rw-r--r-- | pyramid/httpexceptions.py | 11 | ||||
| -rw-r--r-- | pyramid/tests/test_httpexceptions.py | 4 |
7 files changed, 25 insertions, 8 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9ed486b26..98fa7f85a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -201,6 +201,11 @@ Bug Fixes default to an iterable instead of ``None``. It may be checked for a length of 0. This was the behavior in 1.5. +- ``pyramid.httpexceptions.HTTPException`` now defaults to + ``520 Unknown Error`` instead of ``None None`` to conform with changes in + WebOb 1.5. + See https://github.com/Pylons/pyramid/pull/1865 + Deprecations ------------ diff --git a/docs/narr/scaffolding.rst b/docs/narr/scaffolding.rst index f924d0d62..4fcdeb537 100644 --- a/docs/narr/scaffolding.rst +++ b/docs/narr/scaffolding.rst @@ -57,6 +57,11 @@ As you create files and directories within the template directory, note that: have that string replaced with the value of the ``var`` variable provided to the scaffold. +- Files that start with a dot (e.g., ``.env``) are ignored and will not be + copied over to the destination directory. If you want to include a file with + a leading dot then you must replace the dot with ``+dot+`` (e.g., + ``+dot+env``). + Otherwise, files and directories which live in the template directory will be copied directly without modification to the ``pcreate`` output location. diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst index a4ab83c45..7fd8173d4 100644 --- a/docs/quick_tutorial/authentication.rst +++ b/docs/quick_tutorial/authentication.rst @@ -123,9 +123,6 @@ Extra Credit #. Can I use a database behind my ``groupfinder`` to look up principals? -#. Do I have to put a ``renderer`` in my ``@forbidden_view_config`` - decorator? - #. Once I am logged in, does any user-centric information get jammed onto each request? Use ``import pdb; pdb.set_trace()`` to answer this. diff --git a/docs/quick_tutorial/authorization.rst b/docs/quick_tutorial/authorization.rst index 08df15a28..855043f7f 100644 --- a/docs/quick_tutorial/authorization.rst +++ b/docs/quick_tutorial/authorization.rst @@ -101,6 +101,9 @@ by decorating the view with ``@forbidden_view_config``. Extra Credit ============ +#. Do I have to put a ``renderer`` in my ``@forbidden_view_config`` + decorator? + #. Perhaps you would like the experience of not having enough permissions (forbidden) to be richer. How could you change this? diff --git a/docs/quick_tutorial/more_view_classes.rst b/docs/quick_tutorial/more_view_classes.rst index c06fb0f15..afbb7cc3a 100644 --- a/docs/quick_tutorial/more_view_classes.rst +++ b/docs/quick_tutorial/more_view_classes.rst @@ -47,7 +47,7 @@ Objectives - Dispatch one route/URL to multiple views based on request data -- Share stated and logic between views and templates via the view class +- Share states and logic between views and templates via the view class Steps ===== 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): |
