Chris McDonough
2012-09-27 072cbf7ae84e80185ebc122d0c11a6838ac36093
commit | author | age
072cbf 1 1.4a2 (2012-09-27)
CM 2 ==================
68c25d 3
d27bc7 4 Bug Fixes
CM 5 ---------
6
4388d3 7 - When trying to determine Mako defnames and Chameleon macro names in asset
CM 8   specifications, take into account that the filename may have a hyphen in
9   it.  See https://github.com/Pylons/pyramid/pull/692
d27bc7 10
68c25d 11 Features
CM 12 --------
13
14 - A new ``pyramid.session.check_csrf_token`` convenience function was added.
15
80cd0b 16 - A ``check_csrf`` view predicate was added.  For example, you can now do
CM 17   ``config.add_view(someview, check_csrf=True)``.  When the predicate is
18   checked, if the ``csrf_token`` value in ``request.params`` matches the CSRF
19   token in the request's session, the view will be permitted to execute.
20   Otherwise, it will not be permitted to execute.
68c25d 21
098599 22 - Add ``Base.metadata.bind = engine`` to alchemy template, so that tables
CM 23   defined imperatively will work.
24
25 Documentation
26 -------------
27
28 - update wiki2 SQLA tutorial with the changes required after inserting
29   ``Base.metadata.bind = engine`` into the alchemy scaffold.
30
ce1e86 31 1.4a1 (2012-09-16)
CM 32 ==================
f6bd88 33
a39dd2 34 Bug Fixes
CM 35 ---------
36
1794b4 37 - Forward port from 1.3 branch: When no authentication policy was configured,
CM 38   a call to ``pyramid.security.effective_principals`` would unconditionally
39   return the empty list.  This was incorrect, it should have unconditionally
40   returned ``[Everyone]``, and now does.
8782de 41
3074e7 42 - Explicit url dispatch regexes can now contain colons.
CM 43   https://github.com/Pylons/pyramid/issues/629
44
e65251 45 - On at least one 64-bit Ubuntu system under Python 3.2, using the
CM 46   ``view_config`` decorator caused a ``RuntimeError: dictionary changed size
47   during iteration`` exception.  It no longer does.  See
48   https://github.com/Pylons/pyramid/issues/635 for more information.
49
8b2675 50 - In Mako Templates lookup, check if the uri is already adjusted and bring
BL 51   it back to an asset spec. Normally occurs with inherited templates or
52   included components.
53   https://github.com/Pylons/pyramid/issues/606
54   https://github.com/Pylons/pyramid/issues/607
55
7853bc 56 - In Mako Templates lookup, check for absolute uri (using mako directories) 
BL 57   when mixing up inheritance with asset specs.
58   https://github.com/Pylons/pyramid/issues/662
59
75a8ff 60 - HTTP Accept headers were not being normalized causing potentially
MM 61   conflicting view registrations to go unnoticed. Two views that only
62   differ in the case ('text/html' vs. 'text/HTML') will now raise an error.
63   https://github.com/Pylons/pyramid/pull/620
64
a9289d 65 - Forward-port from 1.3 branch: when registering multiple views with an
CM 66   ``accept`` predicate in a Pyramid application runing under Python 3, you
67   might have received a ``TypeError: unorderable types: function() <
68   function()`` exception.
69
de797c 70 Features
CM 71 --------
a39dd2 72
d24659 73 - Configurator.add_directive now accepts arbitrary callables like partials or
CM 74   objects implementing ``__call__`` which dont have ``__name__`` and
75   ``__doc__`` attributes.  See https://github.com/Pylons/pyramid/issues/621
76   and https://github.com/Pylons/pyramid/pull/647.
77
95f766 78 - Third-party custom view, route, and subscriber predicates can now be added
CM 79   for use by view authors via
80   ``pyramid.config.Configurator.add_view_predicate``,
81   ``pyramid.config.Configurator.add_route_predicate`` and
82   ``pyramid.config.Configurator.add_subscriber_predicate``.  So, for example,
0196b2 83   doing this::
CM 84
85      config.add_view_predicate('abc', my.package.ABCPredicate)
86
87   Might allow a view author to do this in an application that configured that
88   predicate::
89
90      @view_config(abc=1)
91
95f766 92   Similar features exist for ``add_route``, and ``add_subscriber``.  See
CM 93   "Adding A Third Party View, Route, or Subscriber Predicate" in the Hooks
94   chapter for more information.
0196b2 95
735abf 96   Note that changes made to support the above feature now means that only
CM 97   actions registered using the same "order" can conflict with one another.
98   It used to be the case that actions registered at different orders could
99   potentially conflict, but to my knowledge nothing ever depended on this
100   behavior (it was a bit silly).
101
de797c 102 - Custom objects can be made easily JSON-serializable in Pyramid by defining
CM 103   a ``__json__`` method on the object's class. This method should return
104   values natively serializable by ``json.dumps`` (such as ints, lists,
105   dictionaries, strings, and so forth).
077fa3 106
e012aa 107 - The JSON renderer now allows for the definition of custom type adapters to
CM 108   convert unknown objects to JSON serializations.
109
360f25 110 - As of this release, the ``request_method`` predicate, when used, will also
CM 111   imply that ``HEAD`` is implied when you use ``GET``.  For example, using
112   ``@view_config(request_method='GET')`` is equivalent to using
561a44 113   ``@view_config(request_method=('GET', 'HEAD'))``.  Using
360f25 114   ``@view_config(request_method=('GET', 'POST')`` is equivalent to using
CM 115   ``@view_config(request_method=('GET', 'HEAD', 'POST')``.  This is because
116   HEAD is a variant of GET that omits the body, and WebOb has special support
117   to return an empty body when a HEAD is used.
15c40a 118
023c88 119 - ``config.add_request_method`` has been introduced to support extending
2c2534 120   request objects with arbitrary callables. This method expands on the
MM 121   previous ``config.set_request_property`` by supporting methods as well as
122   properties. This method now causes less code to be executed at
123   request construction time than ``config.set_request_property`` in
124   version 1.3.
fcb209 125
2c2534 126 - Don't add a ``?`` to URLs generated by ``request.resource_url`` if the
fcb209 127   ``query`` argument is provided but empty.
CM 128
2c2534 129 - Don't add a ``?`` to URLs generated by ``request.route_url`` if the
fcb209 130   ``_query`` argument is provided but empty.
988035 131
CM 132 - The static view machinery now raises (rather than returns) ``HTTPNotFound``
133   and ``HTTPMovedPermanently`` exceptions, so these can be caught by the
134   NotFound view (and other exception views).
ea009a 135
54d3e3 136 - The Mako renderer now supports a def name in an asset spec.  When the def
8b55a6 137   name is present in the asset spec, the system will render the template def
CM 138   within the template and will return the result. An example asset spec is
139   ``package:path/to/template#defname.mako``. This will render the def named
54d3e3 140   ``defname`` inside the ``template.mako`` template instead of rendering the
CM 141   entire template.  The old way of returning a tuple in the form
142   ``('defname', {})`` from the view is supported for backward compatibility,
8b55a6 143
CM 144 - The Chameleon ZPT renderer now accepts a macro name in an asset spec.  When
145   the macro name is present in the asset spec, the system will render the
146   macro listed as a ``define-macro`` and return the result instead of
147   rendering the entire template.  An example asset spec:
148   ``package:path/to/template#macroname.pt``.  This will render the macro
149   defined as ``macroname`` within the ``template.pt`` template instead of the
150   entire templae.
61a57e 151
CM 152 - When there is a predicate mismatch exception (seen when no view matches for
153   a given request due to predicates not working), the exception now contains
154   a textual description of the predicate which didn't match.
6b180c 155
CM 156 - An ``add_permission`` directive method was added to the Configurator.  This
157   directive registers a free-standing permission introspectable into the
158   Pyramid introspection system.  Frameworks built atop Pyramid can thus use
159   the the ``permissions`` introspectable category data to build a
160   comprehensive list of permissions supported by a running system.  Before
161   this method was added, permissions were already registered in this
162   introspectable category as a side effect of naming them in an ``add_view``
163   call, this method just makes it possible to arrange for a permission to be
164   put into the ``permissions`` introspectable category without naming it
165   along with an associated view.  Here's an example of usage of
166   ``add_permission``::
167
168       config = Configurator()
169       config.add_permission('view')
2c2534 170
45b6e1 171 - The ``UnencryptedCookieSessionFactoryConfig`` now accepts
MM 172   ``signed_serialize`` and ``signed_deserialize`` hooks which may be used
173   to influence how the sessions are marshalled (by default this is done
174   with HMAC+pickle).
175
28dba0 176 - ``pyramid.testing.DummyRequest`` now supports methods supplied by the
CM 177   ``pyramid.util.InstancePropertyMixin`` class such as ``set_property``.
735987 178
CM 179 - Request properties and methods added via ``config.set_request_property`` or
180   ``config.add_request_method`` are now available to tweens.
181
182 - Request properties and methods added via ``config.set_request_property`` or
183   ``config.add_request_method`` are now available in the request object
184   returned from ``pyramid.paster.bootstrap``.
185
dc8b49 186 - ``request.context`` of environment request during ``bootstrap`` is now the
CM 187   root object if a context isn't already set on a provided request.
188
07cb8f 189 - The ``pyramid.decorator.reify`` function is now an API, and was added to
CM 190   the API documentation.
191
97150c 192 - Added the ``pyramid.testing.testConfig`` context manager, which can be used
CM 193   to generate a configurator in a test, e.g. ``with testing.testConfig(...):``.
194
64452e 195 - Users can now invoke a subrequest from within view code using a new
CM 196   ``request.invoke_subrequest`` API.
37d2c2 197
2c2534 198 Deprecations
MM 199 ------------
200
9cdb28 201 - The ``pyramid.config.Configurator.set_request_property`` has been
CM 202   documentation-deprecated.  The method remains usable but the more
023c88 203   featureful ``pyramid.config.Configurator.add_request_method`` should be
9cdb28 204   used in its place (it has all of the same capabilities but can also extend
CM 205   the request object with methods).
ebcdc7 206
CM 207 Backwards Incompatibilities
208 ---------------------------
209
25d3dd 210 - The Pyramid router no longer adds the values ``bfg.routes.route`` or
ebcdc7 211   ``bfg.routes.matchdict`` to the request's WSGI environment dictionary.
CM 212   These values were docs-deprecated in ``repoze.bfg`` 1.0 (effectively seven
213   minor releases ago).  If your code depended on these values, use
214   request.matched_route and request.matchdict instead.
215
216 - It is no longer possible to pass an environ dictionary directly to
217   ``pyramid.traversal.ResourceTreeTraverser.__call__`` (aka
218   ``ModelGraphTraverser.__call__``).  Instead, you must pass a request
219   object.  Passing an environment instead of a request has generated a
220   deprecation warning since Pyramid 1.1.
221
222 - Pyramid will no longer work properly if you use the
223   ``webob.request.LegacyRequest`` as a request factory.  Instances of the
224   LegacyRequest class have a ``request.path_info`` which return a string.
225   This Pyramid release assumes that ``request.path_info`` will
226   unconditionally be Unicode.
227
3d4272 228 - The functions from ``pyramid.chameleon_zpt`` and ``pyramid.chameleon_text``
CM 229   named ``get_renderer``, ``get_template``, ``render_template``, and
230   ``render_template_to_response`` have been removed.  These have issued a
231   deprecation warning upon import since Pyramid 1.0.  Use
232   ``pyramid.renderers.get_renderer()``,
233   ``pyramid.renderers.get_renderer().implementation()``,
234   ``pyramid.renderers.render()`` or ``pyramid.renderers.render_to_response``
235   respectively instead of these functions.
236
94a6f3 237 - The ``pyramid.configuration`` module was removed.  It had been deprecated
CM 238   since Pyramid 1.0 and printed a deprecation warning upon its use.  Use
239   ``pyramid.config`` instead.
240
b274d0 241 - The ``pyramid.paster.PyramidTemplate`` API was removed.  It had been
CM 242   deprecated since Pyramid 1.1 and issued a warning on import.  If your code
243   depended on this, adjust your code to import
244   ``pyramid.scaffolds.PyramidTemplate`` instead.
245
ef2e51 246 - The ``pyramid.settings.get_settings()`` API was removed.  It had been
CM 247   printing a deprecation warning since Pyramid 1.0.  If your code depended on
248   this API, use ``pyramid.threadlocal.get_current_registry().settings``
249   instead or use the ``settings`` attribute of the registry available from
250   the request (``request.registry.settings``).
251
69e0aa 252 - These APIs from the ``pyramid.testing`` module were removed.  They have
CM 253   been printing deprecation warnings since Pyramid 1.0:
254
255   * ``registerDummySecurityPolicy``, use
256     ``pyramid.config.Configurator.testing_securitypolicy`` instead.
257
258   * ``registerResources`` (aka ``registerModels``, use
259     ``pyramid.config.Configurator.testing_resources`` instead.
260
261   * ``registerEventListener``, use
262     ``pyramid.config.Configurator.testing_add_subscriber`` instead.
263
264   * ``registerTemplateRenderer`` (aka `registerDummyRenderer``), use
265     ``pyramid.config.Configurator.testing_add_template`` instead.
266
267   * ``registerView``, use ``pyramid.config.Configurator.add_view`` instead.
268
269   * ``registerUtility``, use
270     ``pyramid.config.Configurator.registry.registerUtility`` instead.
271
272   * ``registerAdapter``, use
273     ``pyramid.config.Configurator.registry.registerAdapter`` instead.
274
275   * ``registerSubscriber``, use 
276     ``pyramid.config.Configurator.add_subscriber`` instead.
277
278   * ``registerRoute``, use 
279     ``pyramid.config.Configurator.add_route`` instead.
280
281   * ``registerSettings``, use 
282     ``pyramid.config.Configurator.add_settings`` instead.
283
64452e 284 - In Pyramid 1.3 and previous, the ``__call__`` method of a Response object
CM 285   was invoked before any finished callbacks were executed.  As of this
286   release, the ``__call__`` method of a Response object is invoked *after*
287   finished callbacks are executed.  This is in support of the
288   ``request.invoke_subrequest`` feature.
289
b72ba1 290 Documentation
CM 291 -------------
292
293 - Added an "Upgrading Pyramid" chapter to the narrative documentation.  It
07cb8f 294   describes how to cope with deprecations and removals of Pyramid APIs and
CM 295   how to show Pyramid-generated deprecation warnings while running tests and
296   while running a server.
b72ba1 297
37d2c2 298 - Added a "Invoking a Subrequest" chapter to the documentation.  It describes
64452e 299   how to use the new ``request.invoke_subrequest`` API.
37d2c2 300
ebcdc7 301 Dependencies
CM 302 ------------
303
304 - Pyramid now requires WebOb 1.2b3+ (the prior Pyramid release only relied on
305   1.2dev+).  This is to ensure that we obtain a version of WebOb that returns
306   ``request.path_info`` as text.
307