Chris McDonough
2013-09-22 00c590bd7425565221f44b5f0e6eafe3e1fbd4b8
commit | author | age
78b41e 1 1.5a2 (2013-09-22)
CM 2 ==================
f6f1d1 3
c390f4 4 Features
BJR 5 --------
6
cbcd4d 7 - Users can now provide dotted Python names to as the ``factory`` argument
CM 8   the Configurator methods named ``add_{view,route,subscriber}_predicate`` 
9   (instead of passing the predicate factory directly, you can pass a 
10   dotted name which refers to the factory).
c390f4 11
c062d5 12 Bug Fixes
DH 13 ---------
14
f504cc 15 - Fix an exception in ``pyramid.path.package_name`` when resolving the package
CM 16   name for namespace packages that had no ``__file__`` attribute.
c062d5 17
f6f1d1 18 Backwards Incompatibilities
MM 19 ---------------------------
20
0778ee 21 - Pyramid no longer depends on or configures the Mako and Chameleon templating
CM 22   system renderers by default.  Disincluding these templating systems by
23   default means that the Pyramid core has fewer dependencies and can run on
24   future platforms without immediate concern for the compatibility of its
25   templating add-ons.  It also makes maintenance slightly more effective, as
26   different people can maintain the templating system add-ons that they
27   understand and care about without needing commit access to the Pyramid core,
28   and it allows users who just don't want to see any packages they don't use
29   come along for the ride when they install Pyramid.
82f970 30
0778ee 31   This means that upon upgrading to Pyramid 1.5a2+, projects that use either
CM 32   of these templating systems will see a traceback that ends something like
33   this when their application attempts to render a Chameleon or Mako template::
34
35      ValueError: No such renderer factory .pt
36
37   Or::
38
39      ValueError: No such renderer factory .mako
40
41   Or::
42
43      ValueError: No such renderer factory .mak
44
45   Support for Mako templating has been moved into an add-on package named 
46   ``pyramid_mako``, and support for Chameleon templating has been moved into 
47   an add-on package named ``pyramid_chameleon``.  These packages are drop-in 
48   replacements for the old built-in support for these templating langauges. 
49   All you have to do is install them and make them active in your configuration
50   to register renderer factories for ``.pt`` and/or ``.mako`` (or ``.mak``) to
51   make your application work again.
52
53   To re-add support for Chameleon and/or Mako template renderers into your
54   existing projects, follow the below steps.
55
56   If you depend on Mako templates:
57
58   * Make sure the ``pyramid_mako`` package is installed.  One way to do this
59     is by adding ``pyramid_mako`` to the ``install_requires`` section of your
60     package's ``setup.py`` file and afterwards rerunning ``setup.py develop``::
ce138c 61
MM 62         setup(
63             #...
64             install_requires=[
65                 'pyramid_mako',         # new dependency
66                 'pyramid',
67                 #...
68             ],
69         )
82f970 70
0778ee 71   * Within the portion of your application which instantiates a Pyramid 
CM 72     ``pyramid.config.Configurator`` (often the ``main()`` function in 
73     your project's ``__init__.py`` file), tell Pyramid to include the 
74     ``pyramid_mako`` includeme::
82f970 75
0778ee 76         config = Configurator(.....)
CM 77         config.include('pyramid_mako')
78
79   If you depend on Chameleon templates:
80
81   * Make sure the ``pyramid_chameleon`` package is installed.  One way to do
82     this is by adding ``pyramid_chameleon`` to the ``install_requires`` section
83     of your package's ``setup.py`` file and afterwards rerunning 
84     ``setup.py develop``::
85
86         setup(
87             #...
88             install_requires=[
89                 'pyramid_chameleon',         # new dependency
90                 'pyramid',
91                 #...
92             ],
93         )
94
95   * Within the portion of your application which instantiates a Pyramid 
96     ``~pyramid.config.Configurator`` (often the ``main()`` function in 
97     your project's ``__init__.py`` file), tell Pyramid to include the 
98     ``pyramid_chameleon`` includeme::
99
100         config = Configurator(.....)
82f970 101         config.include('pyramid_chameleon')
MM 102
0778ee 103   Note that it's also fine to install these packages into *older* Pyramids for
CM 104   forward compatibility purposes.  Even if you don't upgrade to Pyramid 1.5
105   immediately, performing the above steps in a Pyramid 1.4 installation is
106   perfectly fine, won't cause any difference, and will give you forward
107   compatibility when you eventually do upgrade to Pyramid 1.5.
9ed074 108
0778ee 109   With the removal of Mako and Chameleon support from the core, some
CM 110   unit tests that use the ``pyramid.renderers.render*`` methods may begin to 
111   fail.  If any of your unit tests are invoking either 
112   ``pyramid.renderers.render()``  or ``pyramid.renderers.render_to_response()``
113   with either Mako or Chameleon templates then the 
114   ``pyramid.config.Configurator`` instance in effect during
115   the unit test should be also be updated to include the addons, as shown
116   above. For example::
9ed074 117
0778ee 118         class ATest(unittest.TestCase):
CM 119             def setUp(self):
120                 self.config = pyramid.testing.setUp()
121                 self.config.include('pyramid_mako')
82f970 122
0778ee 123             def test_it(self):
CM 124                 result = pyramid.renderers.render('mypkg:templates/home.mako', {})
125
126   Or::
127
128         class ATest(unittest.TestCase):
129             def setUp(self):
130                 self.config = pyramid.testing.setUp()
131                 self.config.include('pyramid_chameleon')
132
133             def test_it(self):
134                 result = pyramid.renderers.render('mypkg:templates/home.pt', {})
135
136 - If you're using the Pyramid debug toolbar, when you upgrade Pyramid to
137   1.5a2+, you'll also need to upgrade the ``pyramid_debugtoolbar`` package to 
138   at least version 1.0.8, as older toolbar versions are not compatible with 
139   Pyramid 1.5a2+ due to the removal of Mako support from the core.  It's 
140   fine to use this newer version of the toolbar code with older Pyramids too.
ec0c5c 141
f6f1d1 142 - Removed the ``request.response_*`` varying attributes. These attributes
MM 143   have been deprecated since Pyramid 1.1, and as per the deprecation policy,
144   have now been removed.
145
027c98 146 - ``request.response`` will no longer be mutated when using the 
CM 147   ``pyramid.renderers.render()`` API.  Almost all renderers mutate the 
fbdc3a 148   ``request.response`` response object (for example, the JSON renderer sets
MM 149   ``request.response.content_type`` to ``application/json``), but this is
150   only necessary when the renderer is generating a response; it was a bug
151   when it was done as a side effect of calling ``pyramid.renderers.render()``.
f504cc 152
CM 153 - Removed the ``bfg2pyramid`` fixer script.
154
fc477b 155 - The ``pyramid.events.NewResponse`` event is now sent **after** response 
CM 156   callbacks are executed.  It previously executed before response callbacks
157   were executed.  Rationale: it's more useful to be able to inspect the response
158   after response callbacks have done their jobs instead of before.
159
2c4f4e 160 - Removed the class named ``pyramid.view.static`` that had been deprecated
CM 161   since Pyramid 1.1.  Instead use ``pyramid.static.static_view`` with
162   ``use_subpath=True`` argument.
163
780bbf 164 - Removed the ``pyramid.view.is_response`` function that had been deprecated
CM 165   since Pyramid 1.1.  Use the ``pyramid.request.Request.is_response`` method
166   instead.
167
fdf30b 168 - Removed the ability to pass the following arguments to
6c4293 169   ``pyramid.config.Configurator.add_route``: ``view``, ``view_context``.
fdf30b 170   ``view_for``, ``view_permission``, ``view_renderer``, and ``view_attr``.
CM 171   Using these arguments had been deprecated since Pyramid 1.1.  Instead of
172   passing view-related arguments to ``add_route``, use a separate call to
173   ``pyramid.config.Configurator.add_view`` to associate a view with a route
174   using its ``route_name`` argument.  Note that this impacts the
175   ``pyramid.config.Configurator.add_static_view`` function too, because it
176   delegates to ``add_route``.
177
8fe57d 178 - Removed the ability to influence and query a ``pyramid.request.Request``
CM 179   object as if it were a dictionary.  Previously it was possible to use methods
180   like ``__getitem__``, ``get``, ``items``, and other dictlike methods to
181   access values in the WSGI environment.  This behavior had been deprecated
182   since Pyramid 1.1.  Use methods of ``request.environ`` (a real dictionary)
183   instead.
184
95e971 185 - Removed ancient backwards compatibily hack in
CM 186   ``pyramid.traversal.DefaultRootFactory`` which populated the ``__dict__`` of
187   the factory with the matchdict values for compatibility with BFG 0.9.
188
c6601f 189 - The ``renderer_globals_factory`` argument to the
CM 190   ``pyramid.config.Configurator` constructor and its ``setup_registry`` method
191   has been removed.  The ``set_renderer_globals_factory`` method of
192   ``pyramid.config.Configurator`` has also been removed.  The (internal)
193   ``pyramid.interfaces.IRendererGlobals`` interface was also removed.  These
194   arguments, methods and interfaces had been deprecated since 1.1.  Use a
195   ``BeforeRender`` event subscriber as documented in the "Hooks" chapter of the
196   Pyramid narrative documentation instead of providing renderer globals values
197   to the configurator.
198
75f385 199 Deprecations
CM 200 ------------
201
202 - The ``pyramid.config.Configurator.set_request_property`` method now issues
203   a deprecation warning when used.  It had been docs-deprecated in 1.4
204   but did not issue a deprecation warning when used.
205
00bb95 206 1.5a1 (2013-08-30)
CM 207 ==================
2d9314 208
MM 209 Features
210 --------
211
c5ed54 212 - A new http exception subclass named ``pyramid.httpexceptions.HTTPSuccessful``
CM 213   was added.  You can use this class as the ``context`` of an exception
214   view to catch all 200-series "exceptions" (e.g. "raise HTTPOk").  This 
215   also allows you to catch *only* the ``HTTPOk`` exception itself; previously
216   this was impossible because a number of other exceptions 
217   (such as ``HTTPNoContent``) inherited from ``HTTPOk``, but now they do not.
218
0a4aed 219 - You can now generate "hybrid" urldispatch/traversal URLs more easily
c29603 220   by using the new ``route_name``, ``route_kw`` and ``route_remainder_name`` 
CM 221   arguments to  ``request.resource_url`` and ``request.resource_path``.  See
222   the new section of the "Combining Traversal and URL Dispatch" documentation 
223   chapter entitled  "Hybrid URL Generation".
0a4aed 224
1930eb 225 - It is now possible to escape double braces in Pyramid scaffolds (unescaped, 
CM 226   these represent replacement values).  You can use ``\{\{a\}\}`` to
227   represent a "bare" ``{{a}}``.  See 
228   https://github.com/Pylons/pyramid/pull/862
229
330164 230 - Add ``localizer`` and ``locale_name`` properties (reified) to the request.
CM 231   See https://github.com/Pylons/pyramid/issues/508.  Note that the 
232   ``pyramid.i18n.get_localizer`` and ``pyramid.i18n.get_locale_name`` functions
233   now simply look up these properties on the request.
c614ff 234
b210ce 235 - Add ``pdistreport`` script, which prints the Python version in use, the
CM 236   Pyramid version in use, and the version number and location of all Python
237   distributions currently installed.
238
32333e 239 - Add the ability to invert the result of any view, route, or subscriber
CM 240   predicate using the ``not_`` class.  For example::
241
242      from pyramid.config import not_
243
244      @view_config(route_name='myroute', request_method=not_('POST'))
245      def myview(request): ...
246
247   The above example will ensure that the view is called if the request method
248   is not POST (at least if no other view is more specific).
249
250   The :class:`pyramid.config.not_` class can be used against any value that is
251   a predicate value passed in any of these contexts:
252
253   - ``pyramid.config.Configurator.add_view``
254
255   - ``pyramid.config.Configurator.add_route``
256
257   - ``pyramid.config.Configurator.add_subscriber``
258
259   - ``pyramid.view.view_config``
260
261   - ``pyramid.events.subscriber``
262
a17863 263 - ``scripts/prequest.py``: add support for submitting ``PUT`` and ``PATCH``
CM 264   requests.  See https://github.com/Pylons/pyramid/pull/1033.  add support for
0d96b7 265   submitting ``OPTIONS`` and ``PROPFIND`` requests, and  allow users to specify
a17863 266   basic authentication credentials in the request via a ``--login`` argument to
CM 267   the script.  See https://github.com/Pylons/pyramid/pull/1039.
f0f92b 268
2d9314 269 - ``ACLAuthorizationPolicy`` supports ``__acl__`` as a callable. This
MM 270   removes the ambiguity between the potential ``AttributeError`` that would
271   be raised on the ``context`` when the property was not defined and the
272   ``AttributeError`` that could be raised from any user-defined code within
273   a dynamic property. It is recommended to define a dynamic ACL as a callable
274   to avoid this ambiguity. See https://github.com/Pylons/pyramid/issues/735.
275
ff41f8 276 - Allow a protocol-relative URL (e.g. ``//example.com/images``) to be passed to
WS 277   ``pyramid.config.Configurator.add_static_view``. This allows
278   externally-hosted static URLs to be generated based on the current protocol.
279
a1f768 280 - The ``AuthTktAuthenticationPolicy`` has two new options to configure its
WA 281   domain usage: 
58c5fe 282
a1f768 283   * ``parent_domain``: if set the authentication cookie is set on
WA 284     the parent domain. This is useful if you have multiple sites sharing the
285     same domain.
286   * ``domain``: if provided the cookie is always set for this domain, bypassing
58c5fe 287     all usual logic.
TL 288
3ea788 289   See https://github.com/Pylons/pyramid/pull/1028,
TL 290   https://github.com/Pylons/pyramid/pull/1072 and
291   https://github.com/Pylons/pyramid/pull/1078.
188aa7 292
23a7c6 293 - The ``AuthTktAuthenticationPolicy`` now supports IPv6 addresses when using
MM 294   the ``include_ip=True`` option. This is possibly incompatible with
295   alternative ``auth_tkt`` implementations, as the specification does not
296   define how to properly handle IPv6. See
297   https://github.com/Pylons/pyramid/issues/831.
298
38844f 299 - Make it possible to use variable arguments via
MM 300   ``pyramid.paster.get_appsettings``. This also allowed the generated
301   ``initialize_db`` script from the ``alchemy`` scaffold to grow support
302   for options in the form ``a=1 b=2`` so you can fill in
303   values in a parameterized ``.ini`` file, e.g.
304   ``initialize_myapp_db etc/development.ini a=1 b=2``.
305   See https://github.com/Pylons/pyramid/pull/911
306
fab845 307 - The ``request.session.check_csrf_token()`` method and the ``check_csrf`` view
CM 308   predicate now take into account the value of the HTTP header named
309   ``X-CSRF-Token`` (as well as the ``csrf_token`` form parameter, which they
310   always did).  The header is tried when the form parameter does not exist.
311
b6a4d4 312 - View lookup will now search for valid views based on the inheritance
MM 313   hierarchy of the context. It tries to find views based on the most
314   specific context first, and upon predicate failure, will move up the
315   inheritance chain to test views found by the super-type of the context.
316   In the past, only the most specific type containing views would be checked
317   and if no matching view could be found then a PredicateMismatch would be
318   raised. Now predicate mismatches don't hide valid views registered on
0d96b7 319   super-types. Here's an example that now works:
9e1e6d 320
b6a4d4 321   .. code-block:: python
9e1e6d 322
b6a4d4 323      class IResource(Interface):
07c189 324
b6a4d4 325          ...
9e1e6d 326
b6a4d4 327      @view_config(context=IResource)
MM 328      def get(context, request):
07c189 329
b6a4d4 330          ...
9e1e6d 331
b6a4d4 332      @view_config(context=IResource, request_method='POST')
MM 333      def post(context, request):
07c189 334
b6a4d4 335          ...
9e1e6d 336
b6a4d4 337      @view_config(context=IResource, request_method='DELETE')
MM 338      def delete(context, request):
07c189 339
b6a4d4 340          ...
9e1e6d 341
e01b1c 342      @implementer(IResource)
b6a4d4 343      class MyResource:
07c189 344
b6a4d4 345          ...
MM 346
347      @view_config(context=MyResource, request_method='POST')
348      def override_post(context, request):
07c189 349
b6a4d4 350          ...
9e1e6d 351
AL 352   Previously the override_post view registration would hide the get
353   and delete views in the context of MyResource -- leading to a
354   predicate mismatch error when trying to use GET or DELETE
355   methods. Now the views are found and no predicate mismatch is
356   raised.
6b9700 357   See https://github.com/Pylons/pyramid/pull/786 and
75fc4a 358   https://github.com/Pylons/pyramid/pull/1004 and
MM 359   https://github.com/Pylons/pyramid/pull/1046
9e1e6d 360
137748 361 - The ``pserve`` command now takes a ``-v`` (or ``--verbose``) flag and a
CM 362   ``-q`` (or ``--quiet``) flag.  Output from running ``pserve`` can be
363   controlled using these flags.  ``-v`` can be specified multiple times to
364   increase verbosity.  ``-q`` sets verbosity to ``0`` unconditionally.  The
365   default verbosity level is ``1``.
366
986dc5 367 - The ``alchemy`` scaffold tests now provide better coverage.  See
CM 368   https://github.com/Pylons/pyramid/pull/1029
369
d07d16 370 - The ``pyramid.config.Configurator.add_route`` method now supports being
CM 371   called with an external URL as pattern. See
67674f 372   https://github.com/Pylons/pyramid/issues/611 and the documentation section 
CM 373   in the "URL Dispatch" chapter entitled "External Routes" for more information.
8a8eff 374
0d96b7 375 Bug Fixes
CM 376 ---------
377
97ed56 378 - It was not possible to use ``pyramid.httpexceptions.HTTPException`` as
CM 379   the ``context`` of an exception view as very general catchall for
380   http-related exceptions when you wanted that exception view to override the 
381   default exception view.  See https://github.com/Pylons/pyramid/issues/985
382
8a7e80 383 - When the ``pyramid.reload_templates`` setting was true, and a Chameleon 
CM 384   template was reloaded, and the renderer specification named a macro 
385   (e.g. ``foo#macroname.pt``), renderings of the template after the template
386   was reloaded due to a file change would produce the entire template body 
387   instead of just a rendering of the macro.  See 
388   https://github.com/Pylons/pyramid/issues/1013.
389
ece96f 390 - Fix an obscure problem when combining a virtual root with a route with a 
CM 391   ``*traverse`` in its pattern.  Now the traversal path generated in
392   such a configuration will be correct, instead of an element missing
393   a leading slash.
394
24c932 395 - Fixed a Mako renderer bug returning a tuple with a previous defname value
3de54e 396   in some circumstances. See https://github.com/Pylons/pyramid/issues/1037
BL 397   for more information.
24c932 398
0d96b7 399 - Make the ``pyramid.config.assets.PackageOverrides`` object implement the API
CM 400   for ``__loader__`` objects specified in PEP 302.  Proxies to the
401   ``__loader__`` set by the importer, if present; otherwise, raises
402   ``NotImplementedError``.  This makes Pyramid static view overrides work
403   properly under Python 3.3 (previously they would not).  See
404   https://github.com/Pylons/pyramid/pull/1015 for more information.
405
406 - ``mako_templating``: added defensive workaround for non-importability of
407   ``mako`` due to upstream ``markupsafe`` dropping Python 3.2 support.  Mako
408   templating will no longer work under the combination of MarkupSafe 0.17 and
409   Python 3.2 (although the combination of MarkupSafe 0.17 and Python 3.3 or any
410   supported Python 2 version will work OK).
411
ea278e 412 - Spaces and dots may now be in mako renderer template paths. This was
MM 413   broken when support for the new makodef syntax was added in 1.4a1.
414   See https://github.com/Pylons/pyramid/issues/950
415
20c57e 416 - ``pyramid.debug_authorization=true`` will now correctly print out
MM 417   ``Allowed`` for views registered with ``NO_PERMISSION_REQUIRED`` instead
418   of invoking the ``permits`` method of the authorization policy.
419   See https://github.com/Pylons/pyramid/issues/954
420
c35b29 421 - Pyramid failed to install on some systems due to being packaged with
MM 422   some test files containing higher order characters in their names. These
423   files have now been removed. See
424   https://github.com/Pylons/pyramid/issues/981
425
050b71 426 - ``pyramid.testing.DummyResource`` didn't define ``__bool__``, so code under
0d96b7 427   Python 3 would use ``__len__`` to find truthiness; this usually caused an
CM 428   instance of DummyResource to be "falsy" instead of "truthy".  See
429   https://github.com/Pylons/pyramid/pull/1032
050b71 430
0a8d50 431 - The ``alchemy`` scaffold would break when the database was MySQL during
CM 432   tables creation.  See https://github.com/Pylons/pyramid/pull/1049
433
6a4a34 434 - The ``current_route_url`` method now attaches the query string to the URL by
JV 435   default. See
0f1bc5 436   https://github.com/Pylons/pyramid/issues/1040
33e0fe 437
d6e8b8 438 - Make ``pserve.cherrypy_server_runner`` Python 3 compatible. See
TL 439   https://github.com/Pylons/pyramid/issues/718
440
33e0fe 441 Backwards Incompatibilities
JV 442 ---------------------------
443
6a4a34 444 - Modified the ``current_route_url`` method in pyramid.Request. The method
JV 445   previously returned the URL without the query string by default, it now does
446   attach the query string unless it is overriden.
0f1bc5 447
58951c 448 - The ``route_url`` and ``route_path`` APIs no longer quote ``/`` 
CM 449   to ``%2F`` when a replacement value contains a ``/``.  This was pointless,
450   as WSGI servers always unquote the slash anyway, and Pyramid never sees the 
451   quoted value.
452
330164 453 - It is no longer possible to set a ``locale_name`` attribute of the request, 
CM 454   nor is it possible to set a ``localizer`` attribute of the request.  These
455   are now "reified" properties that look up a locale name and localizer
456   respectively using the machinery described in the "Internationalization"
457   chapter of the documentation.
458
db0185 459 - If you send an ``X-Vhm-Root`` header with a value that ends with a slash (or
CM 460   any number of slashes), the trailing slash(es) will be removed before a URL
461   is generated when you use use ``request.resource_url`` or
462   ``request.resource_path``.  Previously the virtual root path would not have
463   trailing slashes stripped, which would influence URL generation.
464
465 - The ``pyramid.interfaces.IResourceURL`` interface has now grown two new
466   attributes: ``virtual_path_tuple`` and ``physical_path_tuple``.  These should
467   be the tuple form of the resource's path (physical and virtual).
468