Michael Merickel
2017-06-18 4983421128e2e0fc92c771510f7b3af57de6d855
commit | author | age
c84904 1 1.9a1 (2017-05-01)
MM 2 ==================
bdb8e0 3
fa8a9d 4 Major Features
MM 5 --------------
6
7 - The file format used by all ``p*`` command line scripts such as ``pserve``
8   and ``pshell``, as well as the ``pyramid.paster.bootstrap`` function
9   is now replaceable thanks to a new dependency on
f454b8 10   `plaster <http://docs.pylonsproject.org/projects/plaster/en/latest/>`_.
fa8a9d 11
MM 12   For now, Pyramid is still shipping with integrated support for the
fdd77d 13   PasteDeploy INI format by depending on the
fbfd81 14   `plaster_pastedeploy <https://github.com/Pylons/plaster_pastedeploy>`_
fdd77d 15   binding library. This may change in the future.
fa8a9d 16
MM 17   See https://github.com/Pylons/pyramid/pull/2985
5f4649 18
4c3971 19 - Added an execution policy hook to the request pipeline. An execution
MM 20   policy has the ability to control creation and execution of the request
f454b8 21   objects before they enter the rest of the pipeline. This means for a single
fa8a9d 22   request environ the policy may create more than one request object.
MM 23
24   The first library to use this feature is
25   `pyramid_retry
f454b8 26   <http://docs.pylonsproject.org/projects/pyramid-retry/en/latest/>`_.
fa8a9d 27
MM 28   See https://github.com/Pylons/pyramid/pull/2964
29
6419a3 30 - CSRF support has been refactored out of sessions and into its own
MM 31   independent API in the ``pyramid.csrf`` module. It supports a pluggable
32   ``pyramid.interfaces.ICSRFStoragePolicy`` which can be used to define your
33   own mechanism for generating and validating CSRF tokens. By default,
34   Pyramid continues to use the ``pyramid.csrf.LegacySessionCSRFStoragePolicy``
35   that uses the ``request.session.get_csrf_token`` and
36   ``request.session.new_csrf_token`` APIs under the hood to preserve
37   compatibility. Two new policies are shipped as well,
38   ``pyramid.csrf.SessionCSRFStoragePolicy`` and
39   ``pyramid.csrf.CookieCSRFStoragePolicy`` which will store the CSRF tokens
40   in the session and in a standalone cookie, respectively. The storage policy
41   can be changed by using the new
42   ``pyramid.config.Configurator.set_csrf_storage_policy`` config directive.
43
44   CSRF tokens should be used via the new ``pyramid.csrf.get_csrf_token``,
45   ``pyramid.csrf.new_csrf_token`` and ``pyramid.csrf.check_csrf_token`` APIs
46   in order to continue working if the storage policy is changed. Also, the
47   ``pyramid.csrf.get_csrf_token`` function is injected into templates to be
48   used conveniently in UI code.
49
682a9b 50   See https://github.com/Pylons/pyramid/pull/2854 and
MM 51   https://github.com/Pylons/pyramid/pull/3019
a2c7c7 52
2b9b6c 53 Minor Features
MM 54 --------------
9028c9 55
MM 56 - Support an ``open_url`` config setting in the ``pserve`` section of the
57   config file. This url is used to open a web browser when ``pserve --browser``
58   is invoked. When this setting is unavailable the ``pserve`` script will
59   attempt to guess the port the server is using from the
60   ``server:<server_name>`` section of the config file but there is no
61   requirement that the server is being run in this format so it may fail.
62   See https://github.com/Pylons/pyramid/pull/2984
63
87af11 64 - The ``pyramid.config.Configurator`` can now be used as a context manager
MM 65   which will automatically push/pop threadlocals (similar to
66   ``config.begin()`` and ``config.end()``). It will also automatically perform
67   a ``config.commit()`` and thus it is only recommended to be used at the
68   top-level of your app. See https://github.com/Pylons/pyramid/pull/2874
a2c7c7 69
847fb7 70 - The threadlocals are now available inside any function invoked via
MM 71   ``config.include``. This means the only config-time code that cannot rely
72   on threadlocals is code executed from non-actions inside the main. This
73   can be alleviated by invoking ``config.begin()`` and ``config.end()``
74   appropriately or using the new context manager feature of the configurator.
75   See https://github.com/Pylons/pyramid/pull/2989
76
1cf132 77 Bug Fixes
BJR 78 ---------
45f882 79
564b63 80 - HTTPException's accepts a detail kwarg that may be used to pass additional
BJR 81   details to the exception. You may now pass objects so long as they have a
169155 82   valid __str__ method. See https://github.com/Pylons/pyramid/pull/2951
MM 83
84 - Fix a reference cycle causing memory leaks in which the registry
85   would keep a ``Configurator`` instance alive even after the configurator
86   was discarded. Another fix was also added for the ``global_registries``
87   object in which the registry was stored in a closure preventing it from
88   being deallocated. See https://github.com/Pylons/pyramid/pull/2967
564b63 89
38294e 90 - Fix a bug directly invoking ``pyramid.scripts.pserve.main`` with the
MM 91   ``--reload`` option in which ``sys.argv`` is always used in the subprocess
92   instead of the supplied ``argv``.
93   See https://github.com/Pylons/pyramid/pull/2962
94
1cf132 95 Deprecations
BJR 96 ------------
cb98a9 97
2b9b6c 98 - Pyramid currently depends on ``plaster_pastedeploy`` to simplify the
MM 99   transition to ``plaster`` by maintaining integrated support for INI files.
100   This dependency on ``plaster_pastedeploy`` should be considered subject to
2aebc6 101   Pyramid's deprecation policy and may be removed in the future.
2b9b6c 102   Applications should depend on the appropriate plaster binding to satisfy
MM 103   their needs.
d2f0fe 104
2b9b6c 105 - Retrieving CSRF token from the session has been deprecated in favor of
MM 106   equivalent methods in the ``pyramid.csrf`` module. The CSRF methods
107   (``ISession.get_csrf_token`` and ``ISession.new_csrf_token``) are no longer
108   required on the ``ISession`` interface except when using the default
109   ``pyramid.csrf.LegacySessionCSRFStoragePolicy``.
a2c7c7 110
2b9b6c 111   Also, ``pyramid.session.check_csrf_token`` is now located at
MM 112   ``pyramid.csrf.check_csrf_token``.
113
114   See https://github.com/Pylons/pyramid/pull/2854 and
115   https://github.com/Pylons/pyramid/pull/3019
785088 116
3213e2 117 Backward Incompatibilities
MM 118 --------------------------
119
120 - ``request.exception`` and ``request.exc_info`` will only be set if the
121   response was generated by the EXCVIEW tween. This is to avoid any confusion
122   where a response was generated elsewhere in the pipeline and not in
123   direct relation to the original exception. If anyone upstream wants to
124   catch and render responses for exceptions they should set
125   ``request.exception`` and ``request.exc_info`` themselves to indicate
126   the exception that was squashed when generating the response.
127
e2e51b 128   Similar behavior occurs with ``request.invoke_exception_view`` in which
MM 129   the exception properties are set to reflect the exception if a response
130   is successfully generated by the method.
131
3213e2 132   This is a very minor incompatibility. Most tweens right now would give
MM 133   priority to the raised exception and ignore ``request.exception``. This
134   change just improves and clarifies that bookkeeping by trying to be
135   more clear about the relationship between the response and its squashed
e2e51b 136   exception. See https://github.com/Pylons/pyramid/pull/3029 and
MM 137   https://github.com/Pylons/pyramid/pull/3031
3213e2 138
785088 139 Documentation Changes
MM 140 ---------------------
141
142 - Added the execution policy to the routing diagram in the Request Processing
840508 143   chapter. See https://github.com/Pylons/pyramid/pull/2993