diff options
| -rw-r--r-- | CHANGES.rst | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/authentication.rst | 4 | ||||
| -rw-r--r-- | docs/quick_tutorial/authentication/setup.py | 7 | ||||
| -rw-r--r-- | docs/quick_tutorial/authorization/setup.py | 7 | ||||
| -rw-r--r-- | docs/quick_tutorial/cookiecutters/setup.py | 2 | ||||
| -rw-r--r-- | docs/quick_tutorial/databases/setup.py | 10 | ||||
| -rw-r--r-- | docs/quick_tutorial/forms.rst | 2 | ||||
| -rw-r--r-- | docs/quick_tutorial/forms/setup.py | 6 | ||||
| -rw-r--r-- | docs/quick_tutorial/json/setup.py | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/logging/setup.py | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/more_view_classes/setup.py | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/requirements.rst | 14 | ||||
| -rw-r--r-- | docs/quick_tutorial/retail_forms/setup.py | 7 | ||||
| -rw-r--r-- | docs/quick_tutorial/routing/setup.py | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/sessions/setup.py | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/static_assets/setup.py | 5 | ||||
| -rw-r--r-- | docs/quick_tutorial/templating/setup.py | 3 | ||||
| -rw-r--r-- | docs/quick_tutorial/view_classes/setup.py | 5 | ||||
| -rw-r--r-- | pyramid/httpexceptions.py | 19 |
19 files changed, 65 insertions, 56 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 24122eb72..d24fb24e8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -33,6 +33,11 @@ Features Bug Fixes --------- +- Set appropriate ``code`` and ``title`` attributes on the ``HTTPClientError`` and + ``HTTPServerError`` exception classes. This prevents inadvertently returning a 520 + error code. + See https://github.com/Pylons/pyramid/pull/3280 + Deprecations ------------ diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst index 95acc33e4..529f51ddd 100644 --- a/docs/quick_tutorial/authentication.rst +++ b/docs/quick_tutorial/authentication.rst @@ -39,7 +39,7 @@ Steps .. literalinclude:: authentication/setup.py :language: python - :emphasize-lines: 7 + :emphasize-lines: 4 :linenos: #. We can now install our project in development mode: @@ -94,7 +94,7 @@ Steps #. Click the "Log In" link. -#. Submit the login form with the username ``editor`` and the password +#. Submit the login form with the username ``editor`` and the password ``editor``. #. Note that the "Log In" link has changed to "Logout". diff --git a/docs/quick_tutorial/authentication/setup.py b/docs/quick_tutorial/authentication/setup.py index 808a6f9a9..e89b4e241 100644 --- a/docs/quick_tutorial/authentication/setup.py +++ b/docs/quick_tutorial/authentication/setup.py @@ -1,10 +1,11 @@ from setuptools import setup requires = [ + 'bcrypt', 'pyramid', - 'waitress', 'pyramid_chameleon', - 'bcrypt' + 'waitress', + ] setup(name='tutorial', @@ -13,4 +14,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/authorization/setup.py b/docs/quick_tutorial/authorization/setup.py index 808a6f9a9..e89b4e241 100644 --- a/docs/quick_tutorial/authorization/setup.py +++ b/docs/quick_tutorial/authorization/setup.py @@ -1,10 +1,11 @@ from setuptools import setup requires = [ + 'bcrypt', 'pyramid', - 'waitress', 'pyramid_chameleon', - 'bcrypt' + 'waitress', + ] setup(name='tutorial', @@ -13,4 +14,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/cookiecutters/setup.py b/docs/quick_tutorial/cookiecutters/setup.py index e47cdf8ea..0d1b3f70e 100644 --- a/docs/quick_tutorial/cookiecutters/setup.py +++ b/docs/quick_tutorial/cookiecutters/setup.py @@ -10,8 +10,8 @@ with open(os.path.join(here, 'CHANGES.txt')) as f: requires = [ 'pyramid', - 'pyramid_jinja2', 'pyramid_debugtoolbar', + 'pyramid_jinja2', 'waitress', ] diff --git a/docs/quick_tutorial/databases/setup.py b/docs/quick_tutorial/databases/setup.py index 66045fd7e..13d1d6637 100644 --- a/docs/quick_tutorial/databases/setup.py +++ b/docs/quick_tutorial/databases/setup.py @@ -1,13 +1,13 @@ from setuptools import setup requires = [ + 'deform', 'pyramid', - 'waitress', 'pyramid_chameleon', - 'deform', - 'sqlalchemy', 'pyramid_tm', - 'zope.sqlalchemy' + 'sqlalchemy', + 'waitress', + 'zope.sqlalchemy', ] setup(name='tutorial', @@ -18,4 +18,4 @@ setup(name='tutorial', [console_scripts] initialize_tutorial_db = tutorial.initialize_db:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/forms.rst b/docs/quick_tutorial/forms.rst index 3c865ad09..45eb05a8f 100644 --- a/docs/quick_tutorial/forms.rst +++ b/docs/quick_tutorial/forms.rst @@ -41,7 +41,7 @@ Steps pulls in Colander as a dependency: .. literalinclude:: forms/setup.py - :emphasize-lines: 7 + :emphasize-lines: 4 :linenos: #. We can now install our project in development mode: diff --git a/docs/quick_tutorial/forms/setup.py b/docs/quick_tutorial/forms/setup.py index 5293ef7f0..968889e74 100644 --- a/docs/quick_tutorial/forms/setup.py +++ b/docs/quick_tutorial/forms/setup.py @@ -1,10 +1,10 @@ from setuptools import setup requires = [ + 'deform', 'pyramid', - 'waitress', 'pyramid_chameleon', - 'deform' + 'waitress', ] setup(name='tutorial', @@ -13,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/json/setup.py b/docs/quick_tutorial/json/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/json/setup.py +++ b/docs/quick_tutorial/json/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/logging/setup.py b/docs/quick_tutorial/logging/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/logging/setup.py +++ b/docs/quick_tutorial/logging/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/more_view_classes/setup.py b/docs/quick_tutorial/more_view_classes/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/more_view_classes/setup.py +++ b/docs/quick_tutorial/more_view_classes/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst index a65cfe6d2..6bb12c984 100644 --- a/docs/quick_tutorial/requirements.rst +++ b/docs/quick_tutorial/requirements.rst @@ -202,17 +202,3 @@ part is pretty easy. We'll also install a WSGI server, Waitress. Our Python virtual environment now has the Pyramid software available as well as the ``waitress`` package. -You can optionally install some of the extra Python packages used in this -tutorial. - -.. code-block:: bash - - # Mac and Linux - $ $VENV/bin/pip install webtest pytest pytest-cov deform sqlalchemy \ - pyramid_chameleon pyramid_debugtoolbar pyramid_jinja2 waitress \ - pyramid_tm zope.sqlalchemy - -.. code-block:: doscon - - # Windows - c:\> %VENV%\Scripts\pip install webtest pytest pytest-cov deform sqlalchemy pyramid_chameleon pyramid_debugtoolbar pyramid_jinja2 waitress pyramid_tm zope.sqlalchemy diff --git a/docs/quick_tutorial/retail_forms/setup.py b/docs/quick_tutorial/retail_forms/setup.py index 5293ef7f0..f64049792 100644 --- a/docs/quick_tutorial/retail_forms/setup.py +++ b/docs/quick_tutorial/retail_forms/setup.py @@ -1,10 +1,11 @@ from setuptools import setup requires = [ + 'deform', 'pyramid', - 'waitress', 'pyramid_chameleon', - 'deform' + 'waitress', + ] setup(name='tutorial', @@ -13,4 +14,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/routing/setup.py b/docs/quick_tutorial/routing/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/routing/setup.py +++ b/docs/quick_tutorial/routing/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/sessions/setup.py b/docs/quick_tutorial/sessions/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/sessions/setup.py +++ b/docs/quick_tutorial/sessions/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/static_assets/setup.py b/docs/quick_tutorial/static_assets/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/static_assets/setup.py +++ b/docs/quick_tutorial/static_assets/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/docs/quick_tutorial/templating/setup.py b/docs/quick_tutorial/templating/setup.py index d1910178e..1699d9b1e 100644 --- a/docs/quick_tutorial/templating/setup.py +++ b/docs/quick_tutorial/templating/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', - 'waitress', 'pyramid_chameleon', + 'waitress', + ] setup(name='tutorial', diff --git a/docs/quick_tutorial/view_classes/setup.py b/docs/quick_tutorial/view_classes/setup.py index aefa352d4..1699d9b1e 100644 --- a/docs/quick_tutorial/view_classes/setup.py +++ b/docs/quick_tutorial/view_classes/setup.py @@ -2,8 +2,9 @@ from setuptools import setup requires = [ 'pyramid', + 'pyramid_chameleon', 'waitress', - 'pyramid_chameleon' + ] setup(name='tutorial', @@ -12,4 +13,4 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main """, -)
\ No newline at end of file +) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 1f3934fdc..734080434 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -606,7 +606,8 @@ class HTTPClientError(HTTPError): a bug. A server-side traceback is not warranted. Unless specialized, this is a '400 Bad Request' """ - pass + code = 400 + title = 'Bad Request' class HTTPBadRequest(HTTPClientError): """ @@ -617,8 +618,6 @@ class HTTPBadRequest(HTTPClientError): code: 400, title: Bad Request """ - code = 400 - title = 'Bad Request' explanation = ('The server could not comply with the request since ' 'it is either malformed or otherwise incorrect.') @@ -1032,11 +1031,18 @@ class HTTPServerError(HTTPError): This is an error condition in which the server is presumed to be in-error. Unless specialized, this is a '500 Internal Server Error'. """ - pass - -class HTTPInternalServerError(HTTPServerError): code = 500 title = 'Internal Server Error' + +class HTTPInternalServerError(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server encountered an unexpected condition + which prevented it from fulfilling the request. + + code: 500, title: Internal Server Error + """ explanation = ( 'The server has either erred or is incapable of performing ' 'the requested operation.') @@ -1150,6 +1156,7 @@ for name, value in list(globals().items()): if ( isinstance(value, class_types) and issubclass(value, HTTPException) and + value not in {HTTPClientError, HTTPServerError} and not name.startswith('_') ): code = getattr(value, 'code', None) |
