Michael Merickel
2018-10-18 d3fe14781747539c470089208fa7aeb1b2cbbd6f
commit | author | age
7b024b 1 What's New in Pyramid 1.10
MM 2 ==========================
3
4 This article explains the new features in :app:`Pyramid` version 1.10 as compared to its predecessor, :app:`Pyramid` 1.9. It also documents backwards incompatibilities between the two versions and deprecations added to :app:`Pyramid` 1.10, as well as software dependency changes and notable documentation additions.
5
6 .. note::
7
fa6a9d 8     This release is the last planned feature release to support Python 2.7.
7b024b 9     Bug fixes will continue to be backported until at least 2020-01-01 when Python 2.7 reaches end of life.
b74ccf 10     New features and backports will be reviewed and accepted for the 1.x series of Pyramid but new development will be focused on Pyramid 2.x.
7b024b 11
MM 12 Feature Additions
13 -----------------
14
15 - Add support for Python 3.7. Add testing on Python 3.8 with allowed failures.
16   See https://github.com/Pylons/pyramid/pull/3333
17
18 - Add a context manager :meth:`pyramid.config.Configurator.route_prefix_context` to allow for convenient setting of the ``route_prefix`` for :meth:`pyramid.config.Configurator.include` and :meth:`pyramid.config.Configurator.add_route` calls inside the context.
19   See https://github.com/Pylons/pyramid/pull/3279
20
21 - Added the :meth:`pyramid.config.Configurator.add_accept_view_order` directive, allowing users to specify media type preferences in ambiguous situations such as when several views match.
22   A default ordering is defined for media types that prefers human-readable html/text responses over JSON.
23   See https://github.com/Pylons/pyramid/pull/3326
24
25 - Support a list of media types in the ``accept`` predicate used in :meth:`pyramid.config.Configurator.add_route`.
26   See https://github.com/Pylons/pyramid/pull/3326
27
28 - Added :class:`pyramid.session.JSONSerializer`.
074994 29   See :ref:`pickle_session_deprecation` for more information about this feature.
7b024b 30   See https://github.com/Pylons/pyramid/pull/3353
MM 31
32 - Modify the builtin session implementations to support ``SameSite`` options on cookies and set the default to ``'Lax'``.
33   This affects :func:`pyramid.session.BaseCookieSessionFactory`, :func:`pyramid.session.SignedCookieSessionFactory`, and :func:`pyramid.session.UnencryptedCookieSessionFactoryConfig`.
34   See https://github.com/Pylons/pyramid/pull/3300
35
36 - Modify :class:`pyramid.authentication.AuthTktAuthenticationPolicy` and :class:`pyramid.csrf.CookieCSRFStoragePolicy` to support the ``SameSite`` option on cookies and set the default to ``'Lax'``.
37   See https://github.com/Pylons/pyramid/pull/3319
38
39 - Added new :class:`pyramid.httpexceptions.HTTPPermanentRedirect` exception/response object for a HTTP 308 redirect.
40   See https://github.com/Pylons/pyramid/pull/3302
41
42 - Add ``_depth`` and ``_category`` arguments to all of the venusian decorators.
43   The ``_category`` argument can be used to affect which actions are registered when performing a ``config.scan(..., category=...)`` with a specific category.
44   The ``_depth`` argument should be used when wrapping the decorator in your own.
45   This change affects :func:`pyramid.view.view_config`, :func:`pyramid.view.exception_view_config`, :func:`pyramid.view.forbidden_view_config`, :func:`pyramid.view.notfound_view_config`, :func:`pyramid.events.subscriber` and :func:`pyramid.response.response_adapter` decorators.
46   See https://github.com/Pylons/pyramid/pull/3105 and https://github.com/Pylons/pyramid/pull/3122
47
48 - Fix the :class:`pyramid.request.Request` class name after using :meth:`pyramid.request.Request.set_property` or :meth:`pyramid.config.Configurator.add_request_method` such that the ``str(request.__class__)`` would appear as ``pyramid.request.Request`` instead of ``pyramid.util.Request``.
49   See https://github.com/Pylons/pyramid/pull/3129
50
51 - Add a ``registry`` argument to :func:`pyramid.renderers.get_renderer` to allow users to avoid threadlocals during renderer lookup.
52   See https://github.com/Pylons/pyramid/pull/3358
53
54 - Within ``pshell``, allow the user-defined ``setup`` function to be a generator, in which case it may wrap the command's lifecycle.
55   See https://github.com/Pylons/pyramid/pull/3318
56
57 - Within ``pshell``, variables defined by the ``[pshell]`` settings are available within the user-defined ``setup`` function.
58   See https://github.com/Pylons/pyramid/pull/3318
59
60 - In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package over the legacy imports from `cherrypy.wsgiserver`.
61   See https://github.com/Pylons/pyramid/pull/3235
62
4a5504 63 - :app:`Pyramid`'s test suite is no longer distributed with the universal wheel.
MM 64   See https://github.com/Pylons/pyramid/pull/3387
65
66 - All Python code is now formatted automatically using ``black``.
67   See https://github.com/Pylons/pyramid/pull/3388
68
7b024b 69 Deprecations
MM 70 ------------
71
074994 72 - The :class:`pyramid.interfaces.ISession` interface will move to require JSON-serializable objects in :app:`Pyramid` 2.0. See :ref:`pickle_session_deprecation` for more information about this change.
7b024b 73   See https://github.com/Pylons/pyramid/pull/3353
MM 74
75 - The :func:`pyramid.session.signed_serialize` and :func:`pyramid.session.signed_deserialize` functions will be removed in :app:`Pyramid` 2.0, along with the removal of :func:`pyramid.session.UnencryptedCookieSessionFactoryConfig` which was deprecated in :app:`Pyramid` 1.5.
76   Please switch to using the :func:`pyramid.session.SignedCookieSessionFactory`, copying the code, or another session implementation if you're still using these features.
77   See https://github.com/Pylons/pyramid/pull/3353
78
79 - Media ranges are deprecated in the ``accept`` argument of :meth:`pyramid.config.Configurator.add_route`.
80   Use a list of explicit media types to ``add_route`` to support multiple types.
81   See https://github.com/Pylons/pyramid/pull/3326
82
83 - Media ranges are deprecated in the ``accept`` argument of :meth:`pyramid.config.Configurator.add_view`.
84   There is no replacement for ranges to ``add_view``, but after much discussion the workflow is fundamentally ambiguous in the face of various client-supplied values for the ``Accept`` header.
85   See https://github.com/Pylons/pyramid/pull/3326
86
87 Backward Incompatibilities
88 --------------------------
89
d3fe14 90 - Removed ``pyramid.config.Configurator.set_request_property`` which had been deprecated since :app:`Pyramid` 1.5.
MM 91   Instead use :meth:`pyramid.config.Configurator.add_request_method` with ``reify=True`` or ``property=True``.
92   See https://github.com/Pylons/pyramid/pull/3368
93
94 - On Python 3.4+ the ``repoze.lru`` dependency is dropped.
95   If you were using this package directly in your apps you should make sure that you are depending on it directly within your project.
7b024b 96   See https://github.com/Pylons/pyramid/pull/3140
MM 97
98 - Remove the ``permission`` argument from :meth:`pyramid.config.Configurator.add_route`.
99   This was an argument left over from a feature removed in :app:`Pyramid` 1.5 and has had no effect since then.
100   See https://github.com/Pylons/pyramid/pull/3299
101
d3fe14 102 - Modified the builtin session implementations to set ``SameSite='Lax'`` on cookies.
7b024b 103   This affects :func:`pyramid.session.BaseCookieSessionFactory`, :func:`pyramid.session.SignedCookieSessionFactory`, and :func:`pyramid.session.UnencryptedCookieSessionFactoryConfig`.
MM 104   See https://github.com/Pylons/pyramid/pull/3300
105
106 - Variables defined in the ``[pshell]`` section of the settings will no longer override those set by the ``setup`` function.
107   See https://github.com/Pylons/pyramid/pull/3318
108
109 - :meth:`pyramid.config.Configurator.add_notfound_view` uses default redirect class exception :class:`pyramid.httpexceptions.HTTPTemporaryRedirect` instead of previous :class:`pyramid.httpexceptions.HTTPFound`.
110   See https://github.com/Pylons/pyramid/pull/3328
111
112 - Removed the ``principal`` keyword argument from :func:`pyramid.security.remember` which had been deprecated since :app:`Pyramid` 1.6 and replaced by the ``userid`` argument.
113   See https://github.com/Pylons/pyramid/pull/3369
114
4a5504 115 - Removed the ``pyramid.tests`` subpackage that used to contain the Pyramid test suite.
MM 116   These changes also changed the format of the repository to move the code into a ``src`` folder.
117   See https://github.com/Pylons/pyramid/pull/3387
118
7b024b 119 Documentation Enhancements
MM 120 --------------------------
121
122 - Ad support for Read The Docs Ethical Ads.
123   See https://github.com/Pylons/pyramid/pull/3360 and https://docs.readthedocs.io/en/latest/advertising/ethical-advertising.html
124
125 - Add support for alembic to the pyramid-cookiecutter-alchemy cookiecutter and update the wiki2 tutorial to explain how it works.
126   See https://github.com/Pylons/pyramid/pull/3307 and https://github.com/Pylons/pyramid-cookiecutter-alchemy/pull/7
127
128 - Bump Sphinx to >= 1.7.4 in setup.py to support ``emphasize-lines`` in PDFs and to pave the way for xelatex support.
129   See https://github.com/Pylons/pyramid/pull/3271, https://github.com/Pylons/pyramid/issues/667, and https://github.com/Pylons/pyramid/issues/2572
130
131 - Added extra tests to the quick tutorial.
132   See https://github.com/Pylons/pyramid/pull/3375