From f6cb40b68512c9cb5bab90079ef0f834e7fee647 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 25 Apr 2018 17:24:13 -0700 Subject: Bump sphinx to >=1.7.4 - Closes #3269 and #667 - Paves the way for #2572 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c44117068..eadd1040a 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ tests_require = [ docs_extras = [ - 'Sphinx >= 1.3.5, != 1.7.3', + 'Sphinx >= 1.7.4', 'docutils', 'repoze.sphinx.autointerface', 'pylons_sphinx_latesturl', -- cgit v1.2.3 From 763b7ae22e81e0c7115a578349107154798218cd Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 25 Apr 2018 20:48:37 -0700 Subject: add changelog entry for #3271 --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7a8fa31f2..4cb8ba44b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -42,3 +42,8 @@ Backward Incompatibilities Documentation Changes --------------------- +- Bump Sphinx to >= 1.7.4 in setup.py to support ``emphasize-lines`` in PDFs + and to pave the way for xelatex support. See + https://github.com/Pylons/pyramid/pull/3271, + https://github.com/Pylons/pyramid/issues/667, and + https://github.com/Pylons/pyramid/issues/2572 -- cgit v1.2.3 From 65f4679d7731ab3709780864b4f4174686fd6427 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 26 Apr 2018 00:47:12 -0500 Subject: pyramid no longer depends directly on pastedeploy --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index eadd1040a..cdad8c635 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,6 @@ install_requires = [ 'zope.deprecation >= 3.5.0', # py3 compat 'venusian >= 1.0', # ``ignore`` 'translationstring >= 0.4', # py3 compat - 'PasteDeploy >= 1.5.0', # py3 compat 'plaster', 'plaster_pastedeploy', 'hupper', -- cgit v1.2.3 From c7eca0e3358ff3c733ab5845a6e60c34b3af7488 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Thu, 26 Apr 2018 12:15:49 -0700 Subject: Add yet another wiki to update on release --- RELEASING.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASING.txt b/RELEASING.txt index ba978562e..a415dfe64 100644 --- a/RELEASING.txt +++ b/RELEASING.txt @@ -133,6 +133,8 @@ Marketing and communications - Edit `https://en.wikipedia.org/wiki/Pylons_project `_. +- Edit `https://en.wikipedia.org/wiki/Comparison_of_web_frameworks `_. + - Announce to Twitter. ``` -- cgit v1.2.3 From 21a9376b6c8535432eca527598013a0fbac9a461 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Thu, 26 Apr 2018 12:22:37 -0700 Subject: Forward port some items from 1.9-branch into RELEASING.txt --- RELEASING.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASING.txt b/RELEASING.txt index a415dfe64..bec140309 100644 --- a/RELEASING.txt +++ b/RELEASING.txt @@ -71,9 +71,15 @@ Prepare new release branch - Change setup.py version to the release version number. +- Make sure PyPI long description renders (requires ``readme_renderer`` + installed into your Python):: + + $ python setup.py check -r -s -m + - Create a release tag. -- Build and publish to PyPI:: +- Make sure your Python has ``setuptools-git``, ``twine``, and ``wheel`` + installed and release to PyPI:: $ python setup.py sdist bdist_wheel $ twine upload dist/pyramid-X.X-* -- cgit v1.2.3 From 6f31f1c51c531029a998f707b36a28ee6be43171 Mon Sep 17 00:00:00 2001 From: Joel Rivera Date: Mon, 14 May 2018 10:32:09 -0500 Subject: Removes the step to install additional packages in the quick tutorial. This part is redundant because in the same tutorial we indicate to install the application in development/editable mode with `pip -e` in the next section. (which will install the required dependencies if needed by the app) Related issue: #3181 --- docs/quick_tutorial/requirements.rst | 14 -------------- 1 file changed, 14 deletions(-) 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 -- cgit v1.2.3 From e68e308330bd1626518c695d3253f9db828f4669 Mon Sep 17 00:00:00 2001 From: Radu Revutchi Date: Mon, 14 May 2018 11:34:12 -0400 Subject: fixed issue #3182 - alphabetized dependencies in quick tutorial and aligned emphasize-lines --- docs/quick_tutorial/authentication.rst | 4 ++-- docs/quick_tutorial/authentication/setup.py | 7 ++++--- docs/quick_tutorial/authorization/setup.py | 7 ++++--- docs/quick_tutorial/cookiecutters/setup.py | 2 +- docs/quick_tutorial/databases/setup.py | 10 +++++----- docs/quick_tutorial/forms.rst | 2 +- docs/quick_tutorial/forms/setup.py | 6 +++--- docs/quick_tutorial/json/setup.py | 5 +++-- docs/quick_tutorial/logging/setup.py | 5 +++-- docs/quick_tutorial/more_view_classes/setup.py | 5 +++-- docs/quick_tutorial/retail_forms/setup.py | 7 ++++--- docs/quick_tutorial/routing/setup.py | 5 +++-- docs/quick_tutorial/sessions/setup.py | 5 +++-- docs/quick_tutorial/static_assets/setup.py | 5 +++-- docs/quick_tutorial/templating/setup.py | 3 ++- docs/quick_tutorial/view_classes/setup.py | 5 +++-- 16 files changed, 47 insertions(+), 36 deletions(-) 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/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 +) -- cgit v1.2.3 From 391275df4eabfb2be0c8cac5de70e3a5fad5acfd Mon Sep 17 00:00:00 2001 From: Cris Ewing Date: Mon, 14 May 2018 17:07:00 -0400 Subject: Move base server and client error codes and titles to the base classes. Add a docstring to the HTTPInternalServerError --- pyramid/httpexceptions.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 1f3934fdc..4702a6e8e 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.') -- cgit v1.2.3 From 5a99ad864161750bd05ddf1df368701d64c0a396 Mon Sep 17 00:00:00 2001 From: Cris Ewing Date: Mon, 14 May 2018 17:09:10 -0400 Subject: Update the building of status_dict, now that both the base server and client errors and their specific implementations share an error code. Ensures we only get the specific implementations in status_dict --- pyramid/httpexceptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 4702a6e8e..ac4f57738 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -1156,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) -- cgit v1.2.3 From 19beeacc7e42d026480e16c69e0332082229f341 Mon Sep 17 00:00:00 2001 From: Cris Ewing Date: Mon, 14 May 2018 17:18:56 -0400 Subject: Sets, when you absolutely, positively want those extra microseconds back --- pyramid/httpexceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index ac4f57738..734080434 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -1156,7 +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 + value not in {HTTPClientError, HTTPServerError} and not name.startswith('_') ): code = getattr(value, 'code', None) -- cgit v1.2.3 From 829cc3d225a7a9f09c77c5184243e4db09179225 Mon Sep 17 00:00:00 2001 From: Cris Ewing Date: Tue, 15 May 2018 10:41:10 -0400 Subject: Add changelog entry for this bugfix --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 4cb8ba44b..1771026fc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -28,6 +28,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 ------------ -- cgit v1.2.3 From 4d7625e9b69ba7218ad0ec79f25ce3769b199f54 Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 09:43:46 -0500 Subject: Add cut and paste text to quick tutorial index --- docs/quick_tutorial/index.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/quick_tutorial/index.rst b/docs/quick_tutorial/index.rst index b5b7b3313..f9eaee5ab 100644 --- a/docs/quick_tutorial/index.rst +++ b/docs/quick_tutorial/index.rst @@ -11,6 +11,10 @@ This hands-on tutorial covers "a little about a lot": practical introductions to the most common facilities. Fun, fast-paced, and most certainly not aimed at experts of the Pyramid web framework. +For cut and paste purposes, the source code for all stages of this tutorial can +be browsed on `GitHub `_, +which corresponds to the same location if you have Pyramid sources. + Contents ======== -- cgit v1.2.3 From efd61eb501a29970a3728a026ad0400eaff7e52d Mon Sep 17 00:00:00 2001 From: Hunter Senft-Grupp Date: Mon, 14 May 2018 17:13:30 -0400 Subject: Add Configurator context manager 'route_prefix_context' to allow for adding routes and including configuration callables with a particular route prefix. --- docs/narr/urldispatch.rst | 18 +++++++++++++ pyramid/config/__init__.py | 45 ++++++++++++-------------------- pyramid/config/routes.py | 51 ++++++++++++++++++++++++++++++++++++ pyramid/tests/test_url.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+), 29 deletions(-) diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 9ac01e24a..00c7bd3bf 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -1045,6 +1045,24 @@ may be added in the future. For example: config = Configurator() config.include(users_include, route_prefix='/users') +A convenience context manager exists to set the route prefix for any +:meth:`pyramid.config.Configurator.add_route` or +:meth:`pyramid.config.Configurator.include` calls within the context. + +.. code-block:: python + :linenos: + + from pyramid.config import Configurator + + def timing_include(config): + config.add_route('timing.show_times', '/times') + + def main(global_config, **settings) + config = Configurator() + with config.route_prefix_context('/timing'): + config.include(timing_include) + config.add_route('timing.average', '/average') + .. index:: single: route predicates (custom) diff --git a/pyramid/config/__init__.py b/pyramid/config/__init__.py index a34f0b4db..886eec0df 100644 --- a/pyramid/config/__init__.py +++ b/pyramid/config/__init__.py @@ -790,21 +790,6 @@ class Configurator( action_state = self.action_state - if route_prefix is None: - route_prefix = '' - - old_route_prefix = self.route_prefix - if old_route_prefix is None: - old_route_prefix = '' - - route_prefix = '%s/%s' % ( - old_route_prefix.rstrip('/'), - route_prefix.lstrip('/') - ) - route_prefix = route_prefix.strip('/') - if not route_prefix: - route_prefix = None - c = self.maybe_dotted(callable) module = self.inspect.getmodule(c) if module is c: @@ -825,20 +810,22 @@ class Configurator( if action_state.processSpec(spec): - configurator = self.__class__( - registry=self.registry, - package=package_of(module), - root_package=self.root_package, - autocommit=self.autocommit, - route_prefix=route_prefix, - ) - configurator.basepath = os.path.dirname(sourcefile) - configurator.includepath = self.includepath + (spec,) - self.begin() - try: - c(configurator) - finally: - self.end() + with self.route_prefix_context(route_prefix): + configurator = self.__class__( + registry=self.registry, + package=package_of(module), + root_package=self.root_package, + autocommit=self.autocommit, + route_prefix=self.route_prefix, + ) + configurator.basepath = os.path.dirname(sourcefile) + configurator.includepath = self.includepath + (spec,) + + self.begin() + try: + c(configurator) + finally: + self.end() def add_directive(self, name, directive, action_wrap=True): """ diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index 203baa128..a83b424b6 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -1,3 +1,4 @@ +import contextlib import warnings from pyramid.compat import urlparse @@ -467,3 +468,53 @@ class RoutesConfiguratorMixin(object): self.registry.registerUtility(mapper, IRoutesMapper) return mapper + @contextlib.contextmanager + def route_prefix_context(self, route_prefix): + """ Return this configurator with the + :attr:`pyramid.config.Configurator.route_prefix` attribute mutated to + include the new ``route_prefix``. + + When the context exits, the ``route_prefix`` is reset to the original. + + Example Usage: + + >>> config = Configurator() + >>> with config.route_prefix_context('foo'): + ... config.add_route('bar', '/bar') + + Arguments + + route_prefix + + A string suitable to be used as a route prefix, or ``None``. + + .. versionadded:: 1.9.10 + """ + + original_route_prefix = self.route_prefix + + if route_prefix is None: + route_prefix = '' + + old_route_prefix = self.route_prefix + if old_route_prefix is None: + old_route_prefix = '' + + route_prefix = '{}/{}'.format( + old_route_prefix.rstrip('/'), + route_prefix.lstrip('/'), + ) + + route_prefix = route_prefix.strip('/') + + if not route_prefix: + route_prefix = None + + self.begin() + try: + self.route_prefix = route_prefix + yield + + finally: + self.route_prefix = original_route_prefix + self.end() diff --git a/pyramid/tests/test_url.py b/pyramid/tests/test_url.py index af2e5405c..31b3dd571 100644 --- a/pyramid/tests/test_url.py +++ b/pyramid/tests/test_url.py @@ -1251,6 +1251,70 @@ class Test_external_static_url_integration(unittest.TestCase): request.route_url('acme', foo='bar'), 'http://acme.org/bar') +class Test_with_route_prefix(unittest.TestCase): + + def setUp(self): + self.config = testing.setUp() + + def tearDown(self): + testing.tearDown() + + def _makeRequest(self, route): + from pyramid.request import Request + return Request.blank(route) + + def test_old_route_is_preserved(self): + self.config.route_prefix = 'old_prefix' + with self.config.route_prefix_context('new_addon'): + assert 'new_addon' in self.config.route_prefix + + assert 'old_prefix' == self.config.route_prefix + + def test_route_prefix_none(self): + self.config.route_prefix = 'old_prefix' + with self.config.route_prefix_context(None): + assert 'old_prefix' == self.config.route_prefix + + assert 'old_prefix' == self.config.route_prefix + + def test_route_prefix_empty(self): + self.config.route_prefix = 'old_prefix' + with self.config.route_prefix_context(''): + assert 'old_prefix' == self.config.route_prefix + + assert 'old_prefix' == self.config.route_prefix + + def test_route_has_prefix(self): + with self.config.route_prefix_context('bar'): + self.config.add_route('acme', '/foo') + request = self._makeRequest('/') + self.assertEqual( + request.route_url('acme'), + 'http://localhost/bar/foo', + ) + + def test_route_does_not_have_prefix(self): + with self.config.route_prefix_context('bar'): + pass + + self.config.add_route('acme', '/foo') + request = self._makeRequest('/') + self.assertEqual( + request.route_url('acme'), + 'http://localhost/foo', + ) + + def test_error_reset_prefix(self): + self.config.route_prefix = 'old_prefix' + + try: + with self.config.route_prefix_context('new_prefix'): + raise RuntimeError + except RuntimeError: + pass + + assert self.config.route_prefix == 'old_prefix' + class DummyContext(object): def __init__(self, next=None): self.next = next -- cgit v1.2.3 From 4c2d428ca352f531ba697f913a28aa8c451359bc Mon Sep 17 00:00:00 2001 From: Hunter Senft-Grupp Date: Mon, 14 May 2018 17:13:56 -0400 Subject: Updated CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index b6dbcff2c..60e4e5732 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -316,3 +316,7 @@ Contributors - Deneys Maartens, 2017/11/03 - Heron Rossi, 2018/03/08 + +- Hunter Senft-Grupp, 2018/05/14 + +- Junhak Lee, 2018/05/14 \ No newline at end of file -- cgit v1.2.3 From c0f5f071b4d8672996b006d1ea38b870bfea1e11 Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 15:39:43 -0500 Subject: Removed for code review --- docs/quick_tutorial/index.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/quick_tutorial/index.rst b/docs/quick_tutorial/index.rst index f9eaee5ab..b5b7b3313 100644 --- a/docs/quick_tutorial/index.rst +++ b/docs/quick_tutorial/index.rst @@ -11,10 +11,6 @@ This hands-on tutorial covers "a little about a lot": practical introductions to the most common facilities. Fun, fast-paced, and most certainly not aimed at experts of the Pyramid web framework. -For cut and paste purposes, the source code for all stages of this tutorial can -be browsed on `GitHub `_, -which corresponds to the same location if you have Pyramid sources. - Contents ======== -- cgit v1.2.3 From a3b215947627a6c420a5e1cd12f7bfb23379d831 Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 15:42:28 -0500 Subject: Added cut and paste instructions in new location --- docs/quick_tutorial/tutorial_approach.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick_tutorial/tutorial_approach.rst b/docs/quick_tutorial/tutorial_approach.rst index 8da9f71b3..b76b1be40 100644 --- a/docs/quick_tutorial/tutorial_approach.rst +++ b/docs/quick_tutorial/tutorial_approach.rst @@ -15,7 +15,7 @@ This "Getting Started" tutorial is broken into independent steps, starting with the smallest possible "single file WSGI app" example. Each of these steps introduces a topic and a very small set of concepts via working code. The steps each correspond to a directory in our workspace, where each step's directory is -a Python package. +a Python package. Source code used in this tutorial is located in the `Pyramid repository in the directory "docs/quick_tutorial" `_. You may ``git clone`` the repository, download, or copy-paste the source code. If you do so, then make sure you use the same branch as this documentation. As we develop our tutorial, our directory tree will resemble the structure below: -- cgit v1.2.3 From fe0de812873926ef3d9a36febf207c3dec8582f1 Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 15:50:14 -0500 Subject: Update quick tour index with cut and paste instructions --- docs/quick_tour.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index c6e696ae3..a29a6ea9b 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -10,6 +10,7 @@ for those who want to evaluate Pyramid, whether you are new to Python web frameworks, or a pro in a hurry. For more detailed treatment of each topic, give the :ref:`quick_tutorial` a try. +If you would prefer to cut and paste the example code in this tour you may browsethe source code on `GitHub `. If you have downloaded the source code, you will find the tour in the same location. Installation ============ -- cgit v1.2.3 From 71cc19fcc2cf9fe5353c4c8682088d953b37c6ae Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 15:53:00 -0500 Subject: Update wiki2 tutorial index with cut and paste instructions --- docs/tutorials/wiki2/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/wiki2/index.rst b/docs/tutorials/wiki2/index.rst index 740a7f014..32d2ad0c3 100644 --- a/docs/tutorials/wiki2/index.rst +++ b/docs/tutorials/wiki2/index.rst @@ -8,7 +8,7 @@ This tutorial introduces an :term:`SQLAlchemy` and :term:`URL dispatch`-based application with authentication and authorization. For cut and paste purposes, the source code for all stages of this tutorial can -be browsed on `GitHub `_, +be browsed on `GitHub `_, which corresponds to the same location if you have Pyramid sources. .. toctree:: -- cgit v1.2.3 From f7e065a7831439fcf35f0bedbb5f7081d0a5ee9b Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 15:55:56 -0500 Subject: Update wiki tutorial index with cut and paste instructions --- docs/tutorials/wiki/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/wiki/index.rst b/docs/tutorials/wiki/index.rst index 7bd58656b..4c107a364 100644 --- a/docs/tutorials/wiki/index.rst +++ b/docs/tutorials/wiki/index.rst @@ -10,7 +10,7 @@ finished, the developer will have created a basic Wiki application with authentication. For cut and paste purposes, the source code for all stages of this -tutorial can be browsed on GitHub at `GitHub `_ for a specific branch or version under ``docs/tutorials/wiki/src``, +tutorial can be browsed on GitHub at `GitHub `_ for a specific branch or version under ``docs/tutorials/wiki/src``, which corresponds to the same location if you have Pyramid sources. .. toctree:: -- cgit v1.2.3 From d71bbc6358e1bc5a84a2d9ab637bdf32d027431c Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Tue, 15 May 2018 16:08:10 -0500 Subject: Fix misspelling --- docs/quick_tour.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index a29a6ea9b..6d31cdc4e 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -10,7 +10,7 @@ for those who want to evaluate Pyramid, whether you are new to Python web frameworks, or a pro in a hurry. For more detailed treatment of each topic, give the :ref:`quick_tutorial` a try. -If you would prefer to cut and paste the example code in this tour you may browsethe source code on `GitHub `. If you have downloaded the source code, you will find the tour in the same location. +If you would prefer to cut and paste the example code in this tour you may browse the source code on `GitHub `. If you have downloaded the source code, you will find the tour in the same location. Installation ============ -- cgit v1.2.3 From 21ea2cb9e6dbb509ba275f9d4cbad6258a9c3c51 Mon Sep 17 00:00:00 2001 From: Radu Revutchi Date: Tue, 15 May 2018 18:08:19 -0400 Subject: issue #3182 removed extra lines from previous PR --- docs/quick_tutorial/authentication/setup.py | 1 - docs/quick_tutorial/authorization/setup.py | 1 - docs/quick_tutorial/json/setup.py | 1 - docs/quick_tutorial/logging/setup.py | 1 - docs/quick_tutorial/more_view_classes/setup.py | 1 - docs/quick_tutorial/retail_forms/setup.py | 1 - docs/quick_tutorial/routing/setup.py | 1 - docs/quick_tutorial/sessions/setup.py | 1 - docs/quick_tutorial/static_assets/setup.py | 1 - docs/quick_tutorial/templating/setup.py | 1 - docs/quick_tutorial/view_classes/setup.py | 1 - 11 files changed, 11 deletions(-) diff --git a/docs/quick_tutorial/authentication/setup.py b/docs/quick_tutorial/authentication/setup.py index e89b4e241..a5117af5a 100644 --- a/docs/quick_tutorial/authentication/setup.py +++ b/docs/quick_tutorial/authentication/setup.py @@ -5,7 +5,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/authorization/setup.py b/docs/quick_tutorial/authorization/setup.py index e89b4e241..a5117af5a 100644 --- a/docs/quick_tutorial/authorization/setup.py +++ b/docs/quick_tutorial/authorization/setup.py @@ -5,7 +5,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/json/setup.py b/docs/quick_tutorial/json/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/json/setup.py +++ b/docs/quick_tutorial/json/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/logging/setup.py b/docs/quick_tutorial/logging/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/logging/setup.py +++ b/docs/quick_tutorial/logging/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/more_view_classes/setup.py b/docs/quick_tutorial/more_view_classes/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/more_view_classes/setup.py +++ b/docs/quick_tutorial/more_view_classes/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/retail_forms/setup.py b/docs/quick_tutorial/retail_forms/setup.py index f64049792..968889e74 100644 --- a/docs/quick_tutorial/retail_forms/setup.py +++ b/docs/quick_tutorial/retail_forms/setup.py @@ -5,7 +5,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/routing/setup.py b/docs/quick_tutorial/routing/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/routing/setup.py +++ b/docs/quick_tutorial/routing/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/sessions/setup.py b/docs/quick_tutorial/sessions/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/sessions/setup.py +++ b/docs/quick_tutorial/sessions/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/static_assets/setup.py b/docs/quick_tutorial/static_assets/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/static_assets/setup.py +++ b/docs/quick_tutorial/static_assets/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', diff --git a/docs/quick_tutorial/templating/setup.py b/docs/quick_tutorial/templating/setup.py index 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/templating/setup.py +++ b/docs/quick_tutorial/templating/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', '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 1699d9b1e..744612371 100644 --- a/docs/quick_tutorial/view_classes/setup.py +++ b/docs/quick_tutorial/view_classes/setup.py @@ -4,7 +4,6 @@ requires = [ 'pyramid', 'pyramid_chameleon', 'waitress', - ] setup(name='tutorial', -- cgit v1.2.3 From f6aee3428aa70bc8d09ccee46076d0f415c3965d Mon Sep 17 00:00:00 2001 From: Hunter Senft-Grupp Date: Tue, 15 May 2018 23:29:26 -0400 Subject: Updated CHANGES.rst and fixed versionadded to be correct --- CHANGES.rst | 5 +++++ pyramid/config/routes.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 4cb8ba44b..24122eb72 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -25,6 +25,11 @@ Features imports from `cherrypy.wsgiserver`. See https://github.com/Pylons/pyramid/pull/3235 +- Add a context manager ``route_prefix_context`` to the + ``pyramid.config.Configurator`` to allow for convenient setting of the + route_prefix for ``include`` and ``add_route`` calls inside the context. + See https://github.com/Pylons/pyramid/pull/3279 + Bug Fixes --------- diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index a83b424b6..598af300f 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -488,7 +488,7 @@ class RoutesConfiguratorMixin(object): A string suitable to be used as a route prefix, or ``None``. - .. versionadded:: 1.9.10 + .. versionadded:: 1.10 """ original_route_prefix = self.route_prefix -- cgit v1.2.3 From e6581faba90297aec9e41293be8c181f89e6816d Mon Sep 17 00:00:00 2001 From: LuisCastilloH Date: Wed, 16 May 2018 10:14:04 -0500 Subject: Update GitHub URLs for tutorials --- docs/quick_tour.rst | 2 +- docs/quick_tutorial/tutorial_approach.rst | 2 +- docs/tutorials/wiki/index.rst | 2 +- docs/tutorials/wiki2/index.rst | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index 6d31cdc4e..97dda98c0 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -10,7 +10,7 @@ for those who want to evaluate Pyramid, whether you are new to Python web frameworks, or a pro in a hurry. For more detailed treatment of each topic, give the :ref:`quick_tutorial` a try. -If you would prefer to cut and paste the example code in this tour you may browse the source code on `GitHub `. If you have downloaded the source code, you will find the tour in the same location. +If you would prefer to cut and paste the example code in this tour you may browse the source code located in the `Pyramid repository in the directory "docs/quick_tour" `. If you have downloaded the source code, you will find the tour in the same location. Installation ============ diff --git a/docs/quick_tutorial/tutorial_approach.rst b/docs/quick_tutorial/tutorial_approach.rst index b76b1be40..7d87b6a49 100644 --- a/docs/quick_tutorial/tutorial_approach.rst +++ b/docs/quick_tutorial/tutorial_approach.rst @@ -15,7 +15,7 @@ This "Getting Started" tutorial is broken into independent steps, starting with the smallest possible "single file WSGI app" example. Each of these steps introduces a topic and a very small set of concepts via working code. The steps each correspond to a directory in our workspace, where each step's directory is -a Python package. Source code used in this tutorial is located in the `Pyramid repository in the directory "docs/quick_tutorial" `_. You may ``git clone`` the repository, download, or copy-paste the source code. If you do so, then make sure you use the same branch as this documentation. +a Python package. Source code used in this tutorial is located in the `Pyramid repository in the directory "docs/quick_tutorial" `_. You may ``git clone`` the repository, download, or copy-paste the source code. If you do so, then make sure you use the same branch as this documentation. As we develop our tutorial, our directory tree will resemble the structure below: diff --git a/docs/tutorials/wiki/index.rst b/docs/tutorials/wiki/index.rst index 4c107a364..7bd58656b 100644 --- a/docs/tutorials/wiki/index.rst +++ b/docs/tutorials/wiki/index.rst @@ -10,7 +10,7 @@ finished, the developer will have created a basic Wiki application with authentication. For cut and paste purposes, the source code for all stages of this -tutorial can be browsed on GitHub at `GitHub `_ for a specific branch or version under ``docs/tutorials/wiki/src``, +tutorial can be browsed on GitHub at `GitHub `_ for a specific branch or version under ``docs/tutorials/wiki/src``, which corresponds to the same location if you have Pyramid sources. .. toctree:: diff --git a/docs/tutorials/wiki2/index.rst b/docs/tutorials/wiki2/index.rst index 32d2ad0c3..40a194155 100644 --- a/docs/tutorials/wiki2/index.rst +++ b/docs/tutorials/wiki2/index.rst @@ -7,8 +7,8 @@ This tutorial introduces an :term:`SQLAlchemy` and :term:`URL dispatch`-based :app:`Pyramid` application to a developer familiar with Python. When finished, the developer will have created a basic wiki application with authentication and authorization. -For cut and paste purposes, the source code for all stages of this tutorial can -be browsed on `GitHub `_, +For cut and paste purposes, the source code for all stages of this +tutorial can be browsed on GitHub at `GitHub `_ for a specific branch or version under ``docs/tutorials/wiki2/src``, which corresponds to the same location if you have Pyramid sources. .. toctree:: -- cgit v1.2.3 From bf08a77be16b6d76390db38e233bd0f69b247c24 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 24 Apr 2018 14:03:12 -0400 Subject: make pdf rendering work again, less than optimally; take into account new sphinx latex styling, and comment out sections that just dont work now; todo and danger directives are ununsed, so ditch them Signed-off-by: Bert JW Regeer --- docs/conf.py | 78 ++++++++++++++++++++++---------------- docs/typographical-conventions.rst | 24 ------------ 2 files changed, 46 insertions(+), 56 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index cf92e05e8..5d68a73a3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -190,7 +190,10 @@ latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). latex_font_size = '10pt' -latex_additional_files = ['_static/latex-note.png', '_static/latex-warning.png'] +latex_additional_files = [ + '_static/latex-note.png', + '_static/latex-warning.png', +] # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). @@ -276,28 +279,30 @@ _PREAMBLE = r""" \definecolor{VerbatimColor}{rgb}{1,1,1} \definecolor{VerbatimBorderColor}{rgb}{1,1,1} -\makeatletter -\renewcommand{\py@noticestart@warning}{\py@heavybox} -\renewcommand{\py@noticeend@warning}{\py@endheavybox} -\renewcommand{\py@noticestart@note}{\py@heavybox} -\renewcommand{\py@noticeend@note}{\py@endheavybox} -\makeatother +% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) +% \makeatletter +% \renewcommand{\py@noticestart@warning}{\py@heavybox} +% \renewcommand{\py@noticeend@warning}{\py@endheavybox} +% \renewcommand{\py@noticestart@note}{\py@heavybox} +% \renewcommand{\py@noticeend@note}{\py@endheavybox} +% \makeatother % icons in note and warning boxes \usepackage{ifthen} -% Keep a copy of the original notice environment -\let\origbeginnotice\notice -\let\origendnotice\endnotice -% Redefine the notice environment so we can add our own code to it -\renewenvironment{notice}[2]{% - \origbeginnotice{#1}{}% equivalent to original \begin{notice}{#1}{#2} +% Keep a copy of the original sphinxadmonition environment +\let\origbeginadmon\sphinxadmonition +\let\origendadmon\endsphinxadmonition + +% Redefine the sphinxadmonition environment so we can add our own code to it +\renewenvironment{sphinxadmonition}[2]{% + \origbeginadmon{#1}{}% equivalent to original \begin{sphinxadmonition}{#1}{#2} % load graphics \ifthenelse{\equal{#1}{warning}}{\includegraphics{latex-warning.png}}{} \ifthenelse{\equal{#1}{note}}{\includegraphics{latex-note.png}}{} % etc. -}{% - \origendnotice% equivalent to original \end{notice} + }{% +\origendadmon % equivalent to original \end{sphinxadmonition} } % try to prevent code-block boxes from splitting across pages @@ -318,7 +323,8 @@ _PREAMBLE = r""" latex_elements = { 'preamble': _PREAMBLE, - 'wrapperclass': 'book', +# mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) +# 'wrapperclass': 'book', 'date': '', 'releasename': 'Version', 'title': r'The Pyramid Web Framework', @@ -343,15 +349,16 @@ def frontmatter(name, arguments, options, content, lineno, return [nodes.raw( '', r""" -\frontmatter +% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) +% \frontmatter % prevent part/chapter/section numbering -\setcounter{secnumdepth}{-2} +% \setcounter{secnumdepth}{-2} % suppress headers -\pagestyle{plain} +% \pagestyle{plain} % reset page counter -\setcounter{page}{1} +% \setcounter{page}{1} % suppress first toc pagenum -\addtocontents{toc}{\protect\thispagestyle{empty}} +% \addtocontents{toc}{\protect\thispagestyle{empty}} """, format='latex')] @@ -361,25 +368,32 @@ def mainmatter(name, arguments, options, content, lineno, return [nodes.raw( '', r""" -\mainmatter +% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) +% \mainmatter % allow part/chapter/section numbering -\setcounter{secnumdepth}{2} +% \setcounter{secnumdepth}{2} % get headers back -\pagestyle{fancy} -\fancyhf{} -\renewcommand{\headrulewidth}{0.5pt} -\renewcommand{\footrulewidth}{0pt} -\fancyfoot[C]{\thepage} -\fancyhead[RO]{\rightmark} -\fancyhead[LE]{\leftmark} +% \pagestyle{fancy} +% \fancyhf{} +% \renewcommand{\headrulewidth}{0.5pt} +% \renewcommand{\footrulewidth}{0pt} +% \fancyfoot[C]{\thepage} +% \fancyhead[RO]{\rightmark} +% \fancyhead[LE]{\leftmark} """, format='latex')] def backmatter(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): - return [nodes.raw('', '\\backmatter\n\\setcounter{secnumdepth}{-1}\n', - format='latex')] + return [nodes.raw( + '', + r""" +% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) +% \backmatter +% \setcounter{secnumdepth}{-1} + """, + format='latex')] def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]): diff --git a/docs/typographical-conventions.rst b/docs/typographical-conventions.rst index f128effea..2bfe4ffa6 100644 --- a/docs/typographical-conventions.rst +++ b/docs/typographical-conventions.rst @@ -217,18 +217,6 @@ The version in which a feature is deprecated in a project is displayed as follow Use the ``require_csrf`` option or read :ref:`auto_csrf_checking` instead to have :class:`pyramid.exceptions.BadCSRFToken` exceptions raised. -.. _typographical-conventions-danger: - -Danger ------- - -Danger represents critical information related to a topic or concept, and should recommend to the user "don't do this dangerous thing". - -.. danger:: - - This is danger or an error. - - .. _typographical-conventions-warnings: Warnings @@ -265,18 +253,6 @@ See also See :ref:`Quick Tutorial section on Requirements `. -.. _typographical-conventions-todo: - -Todo ----- - -Todo items designated tasks that require further work. - -.. todo:: - - This is a todo item. - - .. _typographical-conventions-cross-references: Cross-references -- cgit v1.2.3 From d4be9a573c575ae38f38325e3e8332eb399ae87e Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 25 Apr 2018 02:40:44 -0700 Subject: Support xelatex for PDF output - Now with Unicode character support --- docs/Makefile | 8 +++++++- docs/conf.py | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index 411ff35df..1c752559c 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -12,7 +12,7 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean html text web pickle htmlhelp latex latexpdf changes linkcheck epub doctest +.PHONY: help clean html text web pickle htmlhelp latex latexpdf changes linkcheck epub doctest xelatexpdf help: @echo "Please use \`make ' where is one of" @@ -30,6 +30,12 @@ help: clean: -rm -rf $(BUILDDIR)/* +xelatexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through xelatex..." + $(MAKE) PDFLATEX=xelatex -C $(BUILDDIR)/latex all-pdf + @echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex." + html: mkdir -p $(BUILDDIR)/html $(BUILDDIR)/doctrees $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html diff --git a/docs/conf.py b/docs/conf.py index 5d68a73a3..c0cb2bdcb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -223,6 +223,17 @@ latex_domain_indices = False _PREAMBLE = r""" \usepackage[]{geometry} \geometry{bindingoffset=0.45in,textheight=7.25in,hdivide={0.5in,*,0.75in},vdivide={1in,7.25in,1in},papersize={7.5in,9.25in}} + +%XeLaTeX packages +\usepackage{xltxtra} +\usepackage{fontspec} %Font package +\usepackage{xunicode} + +%Select fonts +\setmainfont[Mapping=tex-text]{nimbusserif} +\setsansfont[Mapping=tex-text]{nimbussans} +\setmonofont{nimbusmono} + \hypersetup{ colorlinks=true, linkcolor=black, -- cgit v1.2.3 From 1c2e9d014177c304df9b49fc964781b0967552e7 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 16 May 2018 14:09:29 -0700 Subject: Remove lazy commenting. If a printed book format is ever desired again, then there are commits in the history that can be used as a reference and adapted for however it should be done in the future. --- docs/conf.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c0cb2bdcb..993711807 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -290,14 +290,6 @@ _PREAMBLE = r""" \definecolor{VerbatimColor}{rgb}{1,1,1} \definecolor{VerbatimBorderColor}{rgb}{1,1,1} -% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) -% \makeatletter -% \renewcommand{\py@noticestart@warning}{\py@heavybox} -% \renewcommand{\py@noticeend@warning}{\py@endheavybox} -% \renewcommand{\py@noticestart@note}{\py@heavybox} -% \renewcommand{\py@noticeend@note}{\py@endheavybox} -% \makeatother - % icons in note and warning boxes \usepackage{ifthen} @@ -334,8 +326,6 @@ _PREAMBLE = r""" latex_elements = { 'preamble': _PREAMBLE, -# mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) -# 'wrapperclass': 'book', 'date': '', 'releasename': 'Version', 'title': r'The Pyramid Web Framework', @@ -359,18 +349,6 @@ def frontmatter(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): return [nodes.raw( '', - r""" -% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) -% \frontmatter -% prevent part/chapter/section numbering -% \setcounter{secnumdepth}{-2} -% suppress headers -% \pagestyle{plain} -% reset page counter -% \setcounter{page}{1} -% suppress first toc pagenum -% \addtocontents{toc}{\protect\thispagestyle{empty}} -""", format='latex')] @@ -378,20 +356,6 @@ def mainmatter(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): return [nodes.raw( '', - r""" -% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) -% \mainmatter -% allow part/chapter/section numbering -% \setcounter{secnumdepth}{2} -% get headers back -% \pagestyle{fancy} -% \fancyhf{} -% \renewcommand{\headrulewidth}{0.5pt} -% \renewcommand{\footrulewidth}{0pt} -% \fancyfoot[C]{\thepage} -% \fancyhead[RO]{\rightmark} -% \fancyhead[LE]{\leftmark} -""", format='latex')] @@ -399,11 +363,6 @@ def backmatter(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): return [nodes.raw( '', - r""" -% mcdonc commented as part of lazy pdf fixing (pdf_rendering_fixes branch) -% \backmatter -% \setcounter{secnumdepth}{-1} - """, format='latex')] -- cgit v1.2.3 From 298e346e7c7db90a779cfb052a263e561e75a462 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 16 May 2018 23:34:09 -0700 Subject: Remove todo extension and configuration --- docs/conf.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 993711807..80585b336 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,7 +53,6 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', - 'sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinxcontrib.autoprogram', # enable pylons_sphinx_latesturl when this branch is no longer "latest" @@ -124,9 +123,6 @@ exclude_patterns = ['_themes/README.rst', ] # unit titles (such as .. function::). add_module_names = False -# Add support for todo items -todo_include_todos = True - # The name of the Pygments (syntax highlighting) style to use. #pygments_style = book and 'bw' or 'tango' if book: -- cgit v1.2.3 From 54a21885712c6daf367393a0a9d788c2688c48cd Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 16 May 2018 23:35:30 -0700 Subject: Update Makefile and make scripts to use xelatex to build PDF --- docs/Makefile | 5 +++-- docs/make_book | 2 +- docs/make_pdf | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 1c752559c..91f36aefc 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -12,7 +12,7 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean html text web pickle htmlhelp latex latexpdf changes linkcheck epub doctest xelatexpdf +.PHONY: help clean html text web pickle htmlhelp latex latexpdf xelatexpdf changes linkcheck epub doctest help: @echo "Please use \`make ' where is one of" @@ -22,6 +22,7 @@ help: @echo " htmlhelp to make HTML files and a HTML help project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " xelatexpdf to make LaTeX files and run them through xelatex" @echo " changes to make an overview over all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " epub to make an epub" @@ -74,7 +75,7 @@ latex: cp _static/latex-note.png $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make latexpdf' to build a PDF file from them." + @echo "Run \`make xelatexpdf' to build a PDF file from them." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex diff --git a/docs/make_book b/docs/make_book index 94e249441..c3d3743ae 100755 --- a/docs/make_book +++ b/docs/make_book @@ -1,4 +1,4 @@ #!/bin/sh -make clean latex SPHINXBUILD=../env/bin/sphinx-build BOOK=1 +make clean xelatexpdf SPHINXBUILD=../env/bin/sphinx-build BOOK=1 cd _build/latex && make all-pdf diff --git a/docs/make_pdf b/docs/make_pdf index 6c9863bc9..6cf0ff726 100755 --- a/docs/make_pdf +++ b/docs/make_pdf @@ -1,4 +1,4 @@ #!/bin/sh -make clean latex SPHINXBUILD=../env/bin/sphinx-build +make clean xelatexpdf SPHINXBUILD=../env/bin/sphinx-build cd _build/latex && make all-pdf -- cgit v1.2.3 From b1c8eb77e7c1f289f890066328eec6712713e06b Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 16 May 2018 23:36:18 -0700 Subject: Use actual tree output characters, now that we have Unicode support --- docs/quick_tutorial/requirements.rst | 18 +++++++++--------- docs/quick_tutorial/tutorial_approach.rst | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst index 6bb12c984..29f263176 100644 --- a/docs/quick_tutorial/requirements.rst +++ b/docs/quick_tutorial/requirements.rst @@ -79,15 +79,15 @@ will reside as we proceed through the tutorial: .. code-block:: text - `── ~ - `── projects - `── quick_tutorial - │── env - `── step_one - │── intro - │ │── __init__.py - │ `── app.py - `── setup.py + ~ + └── projects + └── quick_tutorial + ├── env + └── step_one + ├── intro + │ ├── __init__.py + │ └── app.py + └── setup.py For Linux, the commands to do so are as follows: diff --git a/docs/quick_tutorial/tutorial_approach.rst b/docs/quick_tutorial/tutorial_approach.rst index 8da9f71b3..cbc5c3449 100644 --- a/docs/quick_tutorial/tutorial_approach.rst +++ b/docs/quick_tutorial/tutorial_approach.rst @@ -23,14 +23,14 @@ below: .. code-block:: text quick_tutorial - │── env - `── request_response - `── tutorial - │ │── __init__.py - │ │── tests.py - │ `── views.py - │── development.ini - `── setup.py + ├── env + └── request_response + ├── tutorial + │ ├── __init__.py + │ ├── tests.py + │ └── views.py + ├── development.ini + └── setup.py Each of the directories in our ``quick_tutorial`` workspace (e.g., ``request_response``) is a *Python project* (except as noted for the ``hello_world`` step). The ``tutorial`` -- cgit v1.2.3 From c7e3c6605428656c893c394684135637c4636733 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Apr 2018 17:39:06 -0600 Subject: Add .cache folder to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fe132412a..2fe3b3386 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ jyenv/ pypyenv/ env*/ venv/ +.cache/ -- cgit v1.2.3 From 21882e4e11a61b9ec639407adb0f67784d2b50b3 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Apr 2018 17:39:27 -0600 Subject: Depend on newer version of WebOb Also sort all of the dependencies --- setup.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/setup.py b/setup.py index cdad8c635..1873612c5 100644 --- a/setup.py +++ b/setup.py @@ -11,47 +11,49 @@ # FITNESS FOR A PARTICULAR PURPOSE # ############################################################################## -from setuptools import setup, find_packages +from setuptools import find_packages, setup + def readfile(name): with open(name) as f: return f.read() + README = readfile('README.rst') CHANGES = readfile('CHANGES.rst') install_requires = [ - 'setuptools', - 'WebOb >= 1.7.0', # Response.has_body - 'zope.interface >= 3.8.0', # has zope.interface.registry - 'zope.deprecation >= 3.5.0', # py3 compat - 'venusian >= 1.0', # ``ignore`` - 'translationstring >= 0.4', # py3 compat + 'hupper', 'plaster', 'plaster_pastedeploy', - 'hupper', - ] + 'setuptools', + 'translationstring >= 0.4', # py3 compat + 'venusian >= 1.0', # ``ignore`` + 'webob >= 1.8.0', # acceptparse.create_accept_header + 'zope.deprecation >= 3.5.0', # py3 compat + 'zope.interface >= 3.8.0', # has zope.interface.registry +] tests_require = [ - 'WebTest >= 1.3.1', # py3 compat - 'zope.component >= 4.0', # py3 compat - ] + 'webtest >= 1.3.1', # py3 compat + 'zope.component >= 4.0', # py3 compat +] docs_extras = [ 'Sphinx >= 1.7.4', 'docutils', - 'repoze.sphinx.autointerface', - 'pylons_sphinx_latesturl', 'pylons-sphinx-themes', + 'pylons_sphinx_latesturl', + 'repoze.sphinx.autointerface', 'sphinxcontrib-autoprogram', - ] +] testing_extras = tests_require + [ - 'nose', 'coverage', + 'nose', 'virtualenv', # for scaffolding tests - ] +] setup(name='pyramid', version='1.10.dev0', @@ -87,7 +89,7 @@ setup(name='pyramid', ':python_version<"3.2"': ['repoze.lru >= 0.4'], 'testing': testing_extras, 'docs': docs_extras, - }, + }, tests_require=tests_require, test_suite="pyramid.tests", entry_points="""\ -- cgit v1.2.3 From 62dbd4554223e4980730c1fb459f5aaf8f946608 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Apr 2018 17:44:08 -0600 Subject: Add failing test for MIMEAccept in httpexceptions --- pyramid/tests/test_httpexceptions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pyramid/tests/test_httpexceptions.py b/pyramid/tests/test_httpexceptions.py index e2d463008..ed6c41e0e 100644 --- a/pyramid/tests/test_httpexceptions.py +++ b/pyramid/tests/test_httpexceptions.py @@ -283,6 +283,17 @@ class TestHTTPException(unittest.TestCase): if header[0] == 'Content-Type': self.assertEqual(header[1], 'application/json') + def test__content_type_invalid(self): + cls = self._getTargetSubclass() + exc = cls() + environ = _makeEnviron() + environ['HTTP_ACCEPT'] = 'invalid' + start_response = DummyStartResponse() + exc(environ, start_response) + for header in start_response.headerlist: + if header[0] == 'Content-Type': + self.assertEqual(header[1], 'text/html; charset=UTF-8') + def test__default_app_iter_with_comment_ampersand(self): cls = self._getTargetSubclass() exc = cls(comment='comment & comment') -- cgit v1.2.3 From 12a58d211a7868337aaf5f040e7cd0c10e095c5b Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Apr 2018 17:44:33 -0600 Subject: Replace MIMEAccept with acceptparse.create_accept_header This is the new API that WebOb makes available and follows the standards. --- pyramid/httpexceptions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 734080434..718d51b50 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -133,7 +133,7 @@ from string import Template from zope.interface import implementer from webob import html_escape as _html_escape -from webob.acceptparse import MIMEAccept +from webob.acceptparse import create_accept_header from pyramid.compat import ( class_types, @@ -250,10 +250,12 @@ ${body}''') html_comment = '' comment = self.comment or '' accept_value = environ.get('HTTP_ACCEPT', '') - accept = MIMEAccept(accept_value) + accept = create_accept_header(accept_value) # Attempt to match text/html or application/json, if those don't # match, we will fall through to defaulting to text/plain - match = accept.best_match(['text/html', 'application/json']) + acceptable = accept.acceptable_offers(['text/html', 'application/json']) + acceptable = [offer[0] for offer in acceptable] + ['text/plain'] + match = acceptable[0] if match == 'text/html': self.content_type = 'text/html' -- cgit v1.2.3 From f7a313d68452840d1f67fe8e808575243af0fb41 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Thu, 5 Apr 2018 17:49:34 -0600 Subject: Update CHANGES.rst for #3251 --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d24fb24e8..334a9b62f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -38,6 +38,11 @@ Bug Fixes error code. See https://github.com/Pylons/pyramid/pull/3280 +- Replace ``webob.acceptparse.MIMEAccept`` from WebOb with + ``webob.acceptparse.create_accept_header`` in the HTTP exception handling + code. The old ``MIMEAccept`` has been deprecated. The new methods follow the + RFC's more closely. See https://github.com/Pylons/pyramid/pull/3251 + Deprecations ------------ -- cgit v1.2.3 From 2cbea29fae5adf311d46b6a1f1dcf8d71a64e5bd Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 19 May 2018 06:42:10 -0700 Subject: use correct file extension for CHANGES --- HACKING.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HACKING.txt b/HACKING.txt index 20cff7cac..8ec44605c 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -242,7 +242,7 @@ or adds the feature. To build and review docs, use the following steps. Change Log ---------- -- Feature additions and bugfixes must be added to the ``CHANGES.txt`` +- Feature additions and bugfixes must be added to the ``CHANGES.rst`` file in the prevailing style. Changelog entries should be long and descriptive, not cryptic. Other developers should be able to know what your changelog entry means. -- cgit v1.2.3 From 2d9390fd73fee560a72d600f846befcb9e140ad0 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 24 May 2018 18:33:29 -0400 Subject: Set the samesite flag to Lax by default on session cookies Also make it possible to set it to other values --- pyramid/session.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pyramid/session.py b/pyramid/session.py index 4a9c8c100..70af99085 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -135,6 +135,7 @@ def BaseCookieSessionFactory( domain=None, secure=False, httponly=False, + samesite='Lax', timeout=1200, reissue_time=0, set_on_exception=True, @@ -187,6 +188,9 @@ def BaseCookieSessionFactory( Hide the cookie from Javascript by setting the 'HttpOnly' flag of the session cookie. Default: ``False``. + ``samesite`` + The 'samesite' option of the session cookie. Default ``'Lax'``. + ``timeout`` A number of seconds of inactivity before a session times out. If ``None`` then the cookie never expires. This lifetime only applies @@ -229,6 +233,7 @@ def BaseCookieSessionFactory( _cookie_domain = domain _cookie_secure = secure _cookie_httponly = httponly + _cookie_samesite = samesite _cookie_on_exception = set_on_exception _timeout = timeout if timeout is None else int(timeout) _reissue_time = reissue_time if reissue_time is None else int(reissue_time) @@ -367,6 +372,7 @@ def BaseCookieSessionFactory( domain=self._cookie_domain, secure=self._cookie_secure, httponly=self._cookie_httponly, + samesite=self._cookie_samesite, ) return True @@ -382,6 +388,7 @@ def UnencryptedCookieSessionFactoryConfig( cookie_domain=None, cookie_secure=False, cookie_httponly=False, + cookie_samesite='Lax', cookie_on_exception=True, signed_serialize=signed_serialize, signed_deserialize=signed_deserialize, @@ -434,6 +441,9 @@ def UnencryptedCookieSessionFactoryConfig( ``cookie_httponly`` The 'httpOnly' flag of the session cookie. + ``cookie_samesite`` + The 'samesite' option of the session cookie. Default: ``'Lax'``. + ``cookie_on_exception`` If ``True``, set a session cookie even if an exception occurs while rendering a view. @@ -469,6 +479,7 @@ def UnencryptedCookieSessionFactoryConfig( domain=cookie_domain, secure=cookie_secure, httponly=cookie_httponly, + samesite=cookie_samesite, timeout=timeout, reissue_time=0, # to keep session.accessed == session.renewed set_on_exception=cookie_on_exception, @@ -491,6 +502,7 @@ def SignedCookieSessionFactory( domain=None, secure=False, httponly=False, + samesite='Lax', set_on_exception=True, timeout=1200, reissue_time=0, @@ -553,6 +565,9 @@ def SignedCookieSessionFactory( Hide the cookie from Javascript by setting the 'HttpOnly' flag of the session cookie. Default: ``False``. + ``samesite`` + The 'samesite' option of the session cookie. Default: ``'Lax'``. + ``timeout`` A number of seconds of inactivity before a session times out. If ``None`` then the cookie never expires. This lifetime only applies @@ -608,6 +623,7 @@ def SignedCookieSessionFactory( domain=domain, secure=secure, httponly=httponly, + samesite=samesite, timeout=timeout, reissue_time=reissue_time, set_on_exception=set_on_exception, -- cgit v1.2.3 From 3d3deebb926a2b7e3f1c1f25fb207858e9677d29 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 24 May 2018 18:40:23 -0400 Subject: fix tests --- pyramid/tests/test_session.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyramid/tests/test_session.py b/pyramid/tests/test_session.py index ade602799..e3d819944 100644 --- a/pyramid/tests/test_session.py +++ b/pyramid/tests/test_session.py @@ -145,13 +145,14 @@ class SharedCookieSessionTests(object): response = Response() self.assertEqual(session._set_cookie(response), True) cookieval = response.headerlist[-1][1] - val, domain, path, secure, httponly = [x.strip() for x in - cookieval.split(';')] + val, domain, path, secure, httponly, samesite = [x.strip() for x in + cookieval.split(';')] self.assertTrue(val.startswith('abc=')) self.assertEqual(domain, 'Domain=localhost') self.assertEqual(path, 'Path=/foo') self.assertEqual(secure, 'secure') self.assertEqual(httponly, 'HttpOnly') + self.assertEqual(samesite, 'SameSite=Lax') def test_flash_default(self): request = testing.DummyRequest() @@ -503,7 +504,7 @@ class TestUnencryptedCookieSession(SharedCookieSessionTests, unittest.TestCase): expected_cookieval = dummy_signed_serialize( (session.accessed, session.created, {'key': 'value'}), secret) response = Response() - response.set_cookie('session', expected_cookieval) + response.set_cookie('session', expected_cookieval, samesite='Lax') expected_cookie = response.headerlist[-1][1] self.assertEqual(cookie, expected_cookie) -- cgit v1.2.3 From bd1cfa871d2abf006a1ab8ae606f7eaf0663a170 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 24 May 2018 18:44:02 -0400 Subject: python 3 fix --- pyramid/session.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyramid/session.py b/pyramid/session.py index 70af99085..25ed29878 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -135,7 +135,7 @@ def BaseCookieSessionFactory( domain=None, secure=False, httponly=False, - samesite='Lax', + samesite=b'Lax', timeout=1200, reissue_time=0, set_on_exception=True, @@ -189,7 +189,7 @@ def BaseCookieSessionFactory( session cookie. Default: ``False``. ``samesite`` - The 'samesite' option of the session cookie. Default ``'Lax'``. + The 'samesite' option of the session cookie. Default ``b'Lax'``. ``timeout`` A number of seconds of inactivity before a session times out. If @@ -388,7 +388,7 @@ def UnencryptedCookieSessionFactoryConfig( cookie_domain=None, cookie_secure=False, cookie_httponly=False, - cookie_samesite='Lax', + cookie_samesite=b'Lax', cookie_on_exception=True, signed_serialize=signed_serialize, signed_deserialize=signed_deserialize, @@ -442,7 +442,7 @@ def UnencryptedCookieSessionFactoryConfig( The 'httpOnly' flag of the session cookie. ``cookie_samesite`` - The 'samesite' option of the session cookie. Default: ``'Lax'``. + The 'samesite' option of the session cookie. Default: ``b'Lax'``. ``cookie_on_exception`` If ``True``, set a session cookie even if an exception occurs @@ -502,7 +502,7 @@ def SignedCookieSessionFactory( domain=None, secure=False, httponly=False, - samesite='Lax', + samesite=b'Lax', set_on_exception=True, timeout=1200, reissue_time=0, @@ -566,7 +566,7 @@ def SignedCookieSessionFactory( session cookie. Default: ``False``. ``samesite`` - The 'samesite' option of the session cookie. Default: ``'Lax'``. + The 'samesite' option of the session cookie. Default: ``b'Lax'``. ``timeout`` A number of seconds of inactivity before a session times out. If -- cgit v1.2.3 From bc8728ae183f04fd0ce7e261fb7731a61163ebbe Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 24 May 2018 18:45:51 -0400 Subject: oops, py3 here too --- pyramid/tests/test_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid/tests/test_session.py b/pyramid/tests/test_session.py index e3d819944..3dd82b5f3 100644 --- a/pyramid/tests/test_session.py +++ b/pyramid/tests/test_session.py @@ -504,7 +504,7 @@ class TestUnencryptedCookieSession(SharedCookieSessionTests, unittest.TestCase): expected_cookieval = dummy_signed_serialize( (session.accessed, session.created, {'key': 'value'}), secret) response = Response() - response.set_cookie('session', expected_cookieval, samesite='Lax') + response.set_cookie('session', expected_cookieval, samesite=b'Lax') expected_cookie = response.headerlist[-1][1] self.assertEqual(cookie, expected_cookie) -- cgit v1.2.3 From 2c5e19954f252cbdb30842140d45df33b1dbe62b Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 24 May 2018 19:26:14 -0400 Subject: Sign CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 60e4e5732..69ed023b0 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -319,4 +319,6 @@ Contributors - Hunter Senft-Grupp, 2018/05/14 -- Junhak Lee, 2018/05/14 \ No newline at end of file +- Junhak Lee, 2018/05/14 + +- Alex Gaynor, 2018/05/24 -- cgit v1.2.3 From 7b6eb3523b9ac35a7cb0b4e717e00fd52067aaa5 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 25 May 2018 10:33:42 -0500 Subject: remove the permission arg from add_route --- CHANGES.rst | 15 ++++++++++----- pyramid/config/routes.py | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 334a9b62f..de7ad0f8a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -21,8 +21,8 @@ Features instead of ``pyramid.util.Request``. See https://github.com/Pylons/pyramid/pull/3129 -- In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package over the legacy - imports from `cherrypy.wsgiserver`. +- In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package + over the legacy imports from `cherrypy.wsgiserver`. See https://github.com/Pylons/pyramid/pull/3235 - Add a context manager ``route_prefix_context`` to the @@ -33,9 +33,9 @@ Features Bug Fixes --------- -- Set appropriate ``code`` and ``title`` attributes on the ``HTTPClientError`` and - ``HTTPServerError`` exception classes. This prevents inadvertently returning a 520 - error code. +- 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 - Replace ``webob.acceptparse.MIMEAccept`` from WebOb with @@ -54,6 +54,11 @@ Backward Incompatibilities depending on it directly within your project. See https://github.com/Pylons/pyramid/pull/3140 +- Remove the ``permission`` argument from + ``pyramid.config.Configurator.add_route``. This was an argument left over + from a feature removed in Pyramid 1.5 and has had no effect since then. + See https://github.com/Pylons/pyramid/pull/3299 + Documentation Changes --------------------- diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index 598af300f..b00886e5d 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -24,7 +24,6 @@ class RoutesConfiguratorMixin(object): def add_route(self, name, pattern=None, - permission=None, factory=None, for_=None, header=None, -- cgit v1.2.3 From 967a06c2f5fe3d510dc825ec7b5ecd3934f93bad Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Tue, 5 Jun 2018 18:51:10 -0600 Subject: Bump version of WebOb required --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1873612c5..17a18f3b5 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ install_requires = [ 'setuptools', 'translationstring >= 0.4', # py3 compat 'venusian >= 1.0', # ``ignore`` - 'webob >= 1.8.0', # acceptparse.create_accept_header + 'webob >= 1.8.2', # cookies.make_cookie allows non-bytes samesite 'zope.deprecation >= 3.5.0', # py3 compat 'zope.interface >= 3.8.0', # has zope.interface.registry ] -- cgit v1.2.3 From 6c8ad427ee2f99c30e52667d5a90226de18d2b2d Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Tue, 5 Jun 2018 19:00:21 -0600 Subject: samesite no longer requires bytes --- pyramid/session.py | 12 ++++++------ pyramid/tests/test_session.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyramid/session.py b/pyramid/session.py index 25ed29878..70af99085 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -135,7 +135,7 @@ def BaseCookieSessionFactory( domain=None, secure=False, httponly=False, - samesite=b'Lax', + samesite='Lax', timeout=1200, reissue_time=0, set_on_exception=True, @@ -189,7 +189,7 @@ def BaseCookieSessionFactory( session cookie. Default: ``False``. ``samesite`` - The 'samesite' option of the session cookie. Default ``b'Lax'``. + The 'samesite' option of the session cookie. Default ``'Lax'``. ``timeout`` A number of seconds of inactivity before a session times out. If @@ -388,7 +388,7 @@ def UnencryptedCookieSessionFactoryConfig( cookie_domain=None, cookie_secure=False, cookie_httponly=False, - cookie_samesite=b'Lax', + cookie_samesite='Lax', cookie_on_exception=True, signed_serialize=signed_serialize, signed_deserialize=signed_deserialize, @@ -442,7 +442,7 @@ def UnencryptedCookieSessionFactoryConfig( The 'httpOnly' flag of the session cookie. ``cookie_samesite`` - The 'samesite' option of the session cookie. Default: ``b'Lax'``. + The 'samesite' option of the session cookie. Default: ``'Lax'``. ``cookie_on_exception`` If ``True``, set a session cookie even if an exception occurs @@ -502,7 +502,7 @@ def SignedCookieSessionFactory( domain=None, secure=False, httponly=False, - samesite=b'Lax', + samesite='Lax', set_on_exception=True, timeout=1200, reissue_time=0, @@ -566,7 +566,7 @@ def SignedCookieSessionFactory( session cookie. Default: ``False``. ``samesite`` - The 'samesite' option of the session cookie. Default: ``b'Lax'``. + The 'samesite' option of the session cookie. Default: ``'Lax'``. ``timeout`` A number of seconds of inactivity before a session times out. If diff --git a/pyramid/tests/test_session.py b/pyramid/tests/test_session.py index 3dd82b5f3..e3d819944 100644 --- a/pyramid/tests/test_session.py +++ b/pyramid/tests/test_session.py @@ -504,7 +504,7 @@ class TestUnencryptedCookieSession(SharedCookieSessionTests, unittest.TestCase): expected_cookieval = dummy_signed_serialize( (session.accessed, session.created, {'key': 'value'}), secret) response = Response() - response.set_cookie('session', expected_cookieval, samesite=b'Lax') + response.set_cookie('session', expected_cookieval, samesite='Lax') expected_cookie = response.headerlist[-1][1] self.assertEqual(cookie, expected_cookie) -- cgit v1.2.3 From beafcc9edd5568a7e4c1bd28f1d6cab376aff64c Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 11 Jun 2018 00:47:51 -0500 Subject: add versionchanged markers --- pyramid/session.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pyramid/session.py b/pyramid/session.py index 70af99085..d05ac66eb 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -189,7 +189,8 @@ def BaseCookieSessionFactory( session cookie. Default: ``False``. ``samesite`` - The 'samesite' option of the session cookie. Default ``'Lax'``. + The 'samesite' option of the session cookie. Set the value to ``None`` + to turn off the samesite option. Default: ``'Lax'``. ``timeout`` A number of seconds of inactivity before a session times out. If @@ -220,6 +221,10 @@ def BaseCookieSessionFactory( while rendering a view. Default: ``True``. .. versionadded: 1.5a3 + + .. versionchanged: 1.10 + + Added the ``samesite`` option and made the default ``'Lax'``. """ @implementer(ISession) @@ -442,7 +447,8 @@ def UnencryptedCookieSessionFactoryConfig( The 'httpOnly' flag of the session cookie. ``cookie_samesite`` - The 'samesite' option of the session cookie. Default: ``'Lax'``. + The 'samesite' option of the session cookie. Set the value to ``None`` + to turn off the samesite option. Default: ``'Lax'``. ``cookie_on_exception`` If ``True``, set a session cookie even if an exception occurs @@ -457,6 +463,10 @@ def UnencryptedCookieSessionFactoryConfig( A callable which takes a signed and serialized data structure in bytes and a secret and returns the original data structure if the signature is valid. Default: ``signed_deserialize`` (using pickle). + + .. versionchanged: 1.10 + + Added the ``samesite`` option and made the default ``'Lax'``. """ class SerializerWrapper(object): @@ -566,7 +576,8 @@ def SignedCookieSessionFactory( session cookie. Default: ``False``. ``samesite`` - The 'samesite' option of the session cookie. Default: ``'Lax'``. + The 'samesite' option of the session cookie. Set the value to ``None`` + to turn off the samesite option. Default: ``'Lax'``. ``timeout`` A number of seconds of inactivity before a session times out. If @@ -604,6 +615,10 @@ def SignedCookieSessionFactory( the :class:`pyramid.session.PickleSerializer` serializer will be used. .. versionadded: 1.5a3 + + .. versionchanged: 1.10 + + Added the ``samesite`` option and made the default ``Lax``. """ if serializer is None: serializer = PickleSerializer() -- cgit v1.2.3 From 57ee91a9f0e3769a725280c3db351fb466bd7431 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 11 Jun 2018 00:56:53 -0500 Subject: add changelog for #3300 --- CHANGES.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 334a9b62f..7c442aa1a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -21,8 +21,8 @@ Features instead of ``pyramid.util.Request``. See https://github.com/Pylons/pyramid/pull/3129 -- In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package over the legacy - imports from `cherrypy.wsgiserver`. +- In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package + over the legacy imports from `cherrypy.wsgiserver`. See https://github.com/Pylons/pyramid/pull/3235 - Add a context manager ``route_prefix_context`` to the @@ -30,6 +30,13 @@ Features route_prefix for ``include`` and ``add_route`` calls inside the context. See https://github.com/Pylons/pyramid/pull/3279 +- Modify the builtin session implementations to support SameSite options on + cookies and set the default to ``'Lax'``. This affects + ``pyramid.session.BaseCookieSessionFactory``, + ``pyramid.session.SignedCookieSessionFactory``, and + ``pyramid.session.UnencryptedCookieSessionFactoryConfig``. + See https://github.com/Pylons/pyramid/pull/3300 + Bug Fixes --------- @@ -54,6 +61,12 @@ Backward Incompatibilities depending on it directly within your project. See https://github.com/Pylons/pyramid/pull/3140 +- Modify the builtin session implementations to set ``SameSite='Lax'`` on + cookies. This affects ``pyramid.session.BaseCookieSessionFactory``, + ``pyramid.session.SignedCookieSessionFactory``, and + ``pyramid.session.UnencryptedCookieSessionFactoryConfig``. + See https://github.com/Pylons/pyramid/pull/3300 + Documentation Changes --------------------- -- cgit v1.2.3 From 56cbb5242ced12a73d9e710fb7e227996b841ef1 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Mon, 11 Jun 2018 15:55:17 -0500 Subject: Add httpexception for status code 308 --- docs/api/httpexceptions.rst | 2 ++ pyramid/httpexceptions.py | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index d4cf97f1d..e25a07cd5 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -51,6 +51,8 @@ .. autoexception:: HTTPTemporaryRedirect + .. autoexception:: HTTPPermanentRedirect + .. autoexception:: HTTPBadRequest .. autoexception:: HTTPUnauthorized diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index 718d51b50..bef8420b1 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -7,7 +7,7 @@ single HTTP status code. Each class is a subclass of the :class:`~HTTPException`. Each exception class is also a :term:`response` object. -Each exception class has a status code according to :rfc:`2068`: +Each exception class has a status code according to :rfc:`2068` or :rfc:`7538`: codes with 100-300 are not really errors; 400s are client errors, and 500s are server errors. @@ -29,6 +29,7 @@ Exception * 304 - HTTPNotModified * 305 - HTTPUseProxy * 307 - HTTPTemporaryRedirect + * 308 - HTTPPermanentRedirect HTTPError HTTPClientError * 400 - HTTPBadRequest @@ -121,10 +122,11 @@ passed to the exception's constructor. The subclasses of :class:`~_HTTPMove` (:class:`~HTTPMultipleChoices`, :class:`~HTTPMovedPermanently`, -:class:`~HTTPFound`, :class:`~HTTPSeeOther`, :class:`~HTTPUseProxy` and -:class:`~HTTPTemporaryRedirect`) are redirections that require a ``Location`` -field. Reflecting this, these subclasses have one additional keyword argument: -``location``, which indicates the location to which to redirect. +:class:`~HTTPFound`, :class:`~HTTPSeeOther`, :class:`~HTTPUseProxy`, +:class:`~HTTPTemporaryRedirect`, and :class: `~HTTPPermanentRedirect) are +redirections that require a ``Location`` field. Reflecting this, these +subclasses have one additional keyword argument: ``location``, +which indicates the location to which to redirect. """ import json @@ -595,6 +597,19 @@ class HTTPTemporaryRedirect(_HTTPMove): code = 307 title = 'Temporary Redirect' +class HTTPPermanentRedirect(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource resides permanently + under a different URI and that the request method must not be + changed. + + code: 308, title: Permanent Redirect + """ + code = 308 + title = 'Permanent Redirect' + ############################################################ ## 4xx client error ############################################################ -- cgit v1.2.3 From ce9d50b0ce5b4e1197544dced96dfa0f7a0402b0 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Mon, 11 Jun 2018 15:55:23 -0500 Subject: Sign contributors file --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 69ed023b0..a28240adf 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -322,3 +322,5 @@ Contributors - Junhak Lee, 2018/05/14 - Alex Gaynor, 2018/05/24 + +- Jason Williams, 2018/06/11 -- cgit v1.2.3 From 93916525d1d6ed6bf5baab3d0e7166549ede639d Mon Sep 17 00:00:00 2001 From: Benjamin Gmurczyk Date: Thu, 14 Jun 2018 12:35:20 -0400 Subject: Update `request_param` kwarg documentation for `add_route` config method See: https://github.com/Pylons/pyramid/pull/705 --- pyramid/config/routes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index b00886e5d..20fdb2b5d 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -198,9 +198,9 @@ class RoutesConfiguratorMixin(object): request_param - This value can be any string. A view declaration with this - argument ensures that the associated route will only match - when the request has a key in the ``request.params`` + This value can be any string or an iterable of strings. A view + declaration with this argument ensures that the associated route will + only match when the request has a key in the ``request.params`` dictionary (an HTTP ``GET`` or ``POST`` variable) that has a name which matches the supplied value. If the value supplied as the argument has a ``=`` sign in it, -- cgit v1.2.3 From f1b72ca6c23ea299f5245a0c299b31e52beae365 Mon Sep 17 00:00:00 2001 From: Benjamin Gmurczyk Date: Thu, 14 Jun 2018 12:41:07 -0400 Subject: Sign CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 69ed023b0..9b7261014 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -322,3 +322,5 @@ Contributors - Junhak Lee, 2018/05/14 - Alex Gaynor, 2018/05/24 + +- Benjamin Gmurczyk, 2018/06/14 -- cgit v1.2.3 From e6c7eafdfcbb1dc8365720a28c92e847bf2e172f Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 15 Jun 2018 00:59:47 -0500 Subject: add changelog for #3302 --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index aeb7c3f9a..e09c3723c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -37,6 +37,10 @@ Features ``pyramid.session.UnencryptedCookieSessionFactoryConfig``. See https://github.com/Pylons/pyramid/pull/3300 +- Added new ``pyramid.httpexceptions.HTTPPermanentRedirect`` + exception/response object for a HTTP 308 redirect. + See https://github.com/Pylons/pyramid/pull/3302 + Bug Fixes --------- -- cgit v1.2.3 From 819732eaaaa1225f1af6d1902fbb5a7dc89a42bf Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Wed, 20 Jun 2018 06:30:06 -0700 Subject: remove html_use_smartypants - for good, now that we specify Sphinx minimum version of 1.7.4 --- docs/conf.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 80585b336..075345d8c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -171,8 +171,6 @@ html_last_updated_fmt = '%b %d, %Y' # Do not use smart quotes. smartquotes = False -# Remove next line when RTD goes to Sphinx==1.6.6 -html_use_smartypants = False # Output file base name for HTML help builder. htmlhelp_basename = 'pyramid' -- cgit v1.2.3 From e7bfdacfea443d3fab4f19f394a0a860f69b3388 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 26 Jun 2018 00:18:26 -0700 Subject: add .python-version to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2fe3b3386..942b3caba 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ pypyenv/ env*/ venv/ .cache/ +.python-version -- cgit v1.2.3 From eab50da2b27b74cd9f64f26f1f6c80935db242c8 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 28 Jun 2018 23:55:31 +0200 Subject: Typos changed --- BFG_HISTORY.rst | 2 +- HISTORY.rst | 10 +++++----- docs/narr/myproject/myproject/templates/layout.jinja2 | 2 +- docs/quick_tour/logging/hello_world/templates/layout.jinja2 | 2 +- docs/quick_tour/package/hello_world/templates/layout.jinja2 | 2 +- docs/quick_tour/sessions/hello_world/templates/layout.jinja2 | 2 +- docs/quick_tour/sqla_demo/sqla_demo/templates/layout.jinja2 | 2 +- .../cookiecutters/cc_starter/templates/layout.jinja2 | 2 +- .../wiki/src/authorization/tutorial/templates/edit.pt | 2 +- .../wiki/src/authorization/tutorial/templates/login.pt | 2 +- .../wiki/src/authorization/tutorial/templates/view.pt | 2 +- .../wiki/src/basiclayout/tutorial/templates/mytemplate.pt | 2 +- .../wiki/src/installation/tutorial/templates/mytemplate.pt | 2 +- .../tutorials/wiki/src/models/tutorial/templates/mytemplate.pt | 2 +- docs/tutorials/wiki/src/tests/tutorial/templates/edit.pt | 2 +- docs/tutorials/wiki/src/tests/tutorial/templates/login.pt | 2 +- docs/tutorials/wiki/src/tests/tutorial/templates/mytemplate.pt | 2 +- docs/tutorials/wiki/src/tests/tutorial/templates/view.pt | 2 +- docs/tutorials/wiki/src/views/tutorial/templates/edit.pt | 2 +- docs/tutorials/wiki/src/views/tutorial/templates/view.pt | 2 +- .../wiki2/src/authentication/tutorial/templates/layout.jinja2 | 2 +- .../wiki2/src/authorization/tutorial/templates/layout.jinja2 | 2 +- .../wiki2/src/basiclayout/tutorial/templates/layout.jinja2 | 2 +- .../wiki2/src/installation/tutorial/templates/layout.jinja2 | 2 +- .../wiki2/src/models/tutorial/templates/layout.jinja2 | 2 +- .../tutorials/wiki2/src/tests/tutorial/templates/layout.jinja2 | 2 +- .../tutorials/wiki2/src/views/tutorial/templates/layout.jinja2 | 2 +- docs/whatsnew-1.0.rst | 6 +++--- pyramid/httpexceptions.py | 2 +- pyramid/resource.py | 2 +- .../scaffolds/alchemy/+package+/templates/layout.jinja2_tmpl | 2 +- .../scaffolds/starter/+package+/templates/layout.jinja2_tmpl | 2 +- pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl | 2 +- 33 files changed, 39 insertions(+), 39 deletions(-) diff --git a/BFG_HISTORY.rst b/BFG_HISTORY.rst index 8a2d40920..685196059 100644 --- a/BFG_HISTORY.rst +++ b/BFG_HISTORY.rst @@ -4281,7 +4281,7 @@ Deprecations - The name ``repoze.bfg.registry.registry_manager`` was never an API, but scripts in the wild were using it to set up an environment for - use under a debug shell. A backwards compatibility shim has been + use under a debug shell. A backwards compatibility shiv has been added for this purpose, but the feature is deprecated. 0.9a1 (2009-5-27) diff --git a/HISTORY.rst b/HISTORY.rst index 8a92eadcc..25dd38488 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4136,7 +4136,7 @@ Bug fixes Bug Fixes --------- -- 1.1a1 broke Akhet by not providing a backwards compatibility import shim +- 1.1a1 broke Akhet by not providing a backwards compatibility import shiv for ``pyramid.paster.PyramidTemplate``. Now one has been added, although a deprecation warning is emitted when Akhet imports it. @@ -4738,7 +4738,7 @@ Deprecations ------------- - Using the ``pyramid.view.bfg_view`` alias for ``pyramid.view.view_config`` - (a backwards compatibility shim) now issues a deprecation warning. + (a backwards compatibility shiv) now issues a deprecation warning. Backwards Incompatibilities --------------------------- @@ -5178,7 +5178,7 @@ Terminology Changes - Positional argument names of various APIs have been changed from ``model`` to ``resource``. - Backwards compatibility shims have been left in place in all cases. They + Backwards compatibility shivs have been left in place in all cases. They will continue to work "forever". - The Pyramid concept previously known as "resource" is now known as "asset". @@ -5205,7 +5205,7 @@ Terminology Changes ``reload_resources`` (config file) is now known, respectively, as ``PYRAMID_RELOAD_ASSETS`` and ``reload_assets``. - Backwards compatibility shims have been left in place in all cases. They + Backwards compatibility shivs have been left in place in all cases. They will continue to work "forever". Bug Fixes @@ -5560,7 +5560,7 @@ Deprecations - Obtaining the ``settings`` object via ``registry.{get|query}Utility(ISettings)`` is now deprecated. Instead, obtain the ``settings`` object via the ``registry.settings`` attribute. A - backwards compatibility shim was added to the registry object to register + backwards compatibility shiv was added to the registry object to register the settings object as an ISettings utility when ``setattr(registry, 'settings', foo)`` is called, but it will be removed in a later release. diff --git a/docs/narr/myproject/myproject/templates/layout.jinja2 b/docs/narr/myproject/myproject/templates/layout.jinja2 index 1baca52bd..38f5ae7a8 100644 --- a/docs/narr/myproject/myproject/templates/layout.jinja2 +++ b/docs/narr/myproject/myproject/templates/layout.jinja2 @@ -16,7 +16,7 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +