commit | author | age
|
d7b647
|
1 |
1.5b1 (2014-02-08) |
CM |
2 |
================== |
579a5f
|
3 |
|
CM |
4 |
Features |
|
5 |
-------- |
|
6 |
|
|
7 |
- We no longer eagerly clear ``request.exception`` and ``request.exc_info`` in |
|
8 |
the exception view tween. This makes it possible to inspect exception |
|
9 |
information within a finished callback. See |
|
10 |
https://github.com/Pylons/pyramid/issues/1223. |
|
11 |
|
2c205f
|
12 |
1.5a4 (2014-01-28) |
CM |
13 |
================== |
6b0d6f
|
14 |
|
480366
|
15 |
Features |
BL |
16 |
-------- |
|
17 |
|
|
18 |
- Updated scaffolds with new theme, fixed documentation and sample project. |
|
19 |
|
6b0d6f
|
20 |
Bug Fixes |
CM |
21 |
--------- |
|
22 |
|
e2600d
|
23 |
- Depend on a newer version of WebOb so that we pull in some crucial bug-fixes |
BJR |
24 |
that were showstoppers for functionality in Pyramid. |
|
25 |
|
6b0d6f
|
26 |
- Add a trailing semicolon to the JSONP response. This fixes JavaScript syntax |
CM |
27 |
errors for old IE versions. See https://github.com/Pylons/pyramid/pull/1205 |
|
28 |
|
f58977
|
29 |
- Fix a memory leak when the configurator's ``set_request_property`` method was |
CM |
30 |
used or when the configurator's ``add_request_method`` method was used with |
|
31 |
the ``property=True`` attribute. See |
|
32 |
https://github.com/Pylons/pyramid/issues/1212 . |
|
33 |
|
5c4318
|
34 |
1.5a3 (2013-12-10) |
CM |
35 |
================== |
5065a5
|
36 |
|
ba419e
|
37 |
Features |
MM |
38 |
-------- |
|
39 |
|
0dcd56
|
40 |
- An authorization API has been added as a method of the |
CM |
41 |
request: ``request.has_permission``. |
0184b5
|
42 |
|
CM |
43 |
``request.has_permission`` is a method-based alternative to the |
|
44 |
``pyramid.security.has_permission`` API and works exactly the same. The |
|
45 |
older API is now deprecated. |
|
46 |
|
|
47 |
- Property API attributes have been added to the request for easier access to |
|
48 |
authentication data: ``request.authenticated_userid``, |
|
49 |
``request.unauthenticated_userid``, and ``request.effective_principals``. |
|
50 |
|
|
51 |
These are analogues, respectively, of |
|
52 |
``pyramid.security.authenticated_userid``, |
|
53 |
``pyramid.security.unauthenticated_userid``, and |
|
54 |
``pyramid.security.effective_principals``. They operate exactly the same, |
|
55 |
except they are attributes of the request instead of functions accepting a |
|
56 |
request. They are properties, so they cannot be assigned to. The older |
|
57 |
function-based APIs are now deprecated. |
3c2f95
|
58 |
|
ba419e
|
59 |
- Pyramid's console scripts (``pserve``, ``pviews``, etc) can now be run |
MM |
60 |
directly, allowing custom arguments to be sent to the python interpreter |
|
61 |
at runtime. For example:: |
|
62 |
|
|
63 |
python -3 -m pyramid.scripts.pserve development.ini |
|
64 |
|
6b0889
|
65 |
- Added a specific subclass of ``HTTPBadRequest`` named |
MM |
66 |
``pyramid.exceptions.BadCSRFToken`` which will now be raised in response |
|
67 |
to failures in ``check_csrf_token``. |
|
68 |
See https://github.com/Pylons/pyramid/pull/1149 |
|
69 |
|
63bf05
|
70 |
- Added a new ``SignedCookieSessionFactory`` which is very similar to the |
ab579e
|
71 |
``UnencryptedCookieSessionFactoryConfig`` but with a clearer focus on signing |
CM |
72 |
content. The custom serializer arguments to this function should only focus |
|
73 |
on serializing, unlike its predecessor which required the serializer to also |
|
74 |
perform signing. See https://github.com/Pylons/pyramid/pull/1142 . Note |
|
75 |
that cookies generated using ``SignedCookieSessionFactory`` are not |
|
76 |
compatible with cookies generated using ``UnencryptedCookieSessionFactory``, |
|
77 |
so existing user session data will be destroyed if you switch to it. |
63bf05
|
78 |
|
MM |
79 |
- Added a new ``BaseCookieSessionFactory`` which acts as a generic cookie |
|
80 |
factory that can be used by framework implementors to create their own |
|
81 |
session implementations. It provides a reusable API which focuses strictly |
|
82 |
on providing a dictionary-like object that properly handles renewals, |
|
83 |
timeouts, and conformance with the ``ISession`` API. |
838556
|
84 |
See https://github.com/Pylons/pyramid/pull/1142 |
63bf05
|
85 |
|
06aee8
|
86 |
- The anchor argument to ``pyramid.request.Request.route_url`` and |
CM |
87 |
``pyramid.request.Request.resource_url`` and their derivatives will now be |
ca419f
|
88 |
escaped via URL quoting to ensure minimal conformance. See |
06aee8
|
89 |
https://github.com/Pylons/pyramid/pull/1183 |
a3654e
|
90 |
|
MM |
91 |
- Allow sending of ``_query`` and ``_anchor`` options to |
|
92 |
``pyramid.request.Request.static_url`` when an external URL is being |
|
93 |
generated. |
|
94 |
See https://github.com/Pylons/pyramid/pull/1183 |
|
95 |
|
06aee8
|
96 |
- You can now send a string as the ``_query`` argument to |
CM |
97 |
``pyramid.request.Request.route_url`` and |
|
98 |
``pyramid.request.Request.resource_url`` and their derivatives. When a |
ca419f
|
99 |
string is sent instead of a list or dictionary. it is URL-quoted however it |
CM |
100 |
does not need to be in ``k=v`` form. This is useful if you want to be able |
|
101 |
to use a different query string format than ``x-www-form-urlencoded``. See |
|
102 |
https://github.com/Pylons/pyramid/pull/1183 |
06aee8
|
103 |
|
767e44
|
104 |
- ``pyramid.testing.DummyRequest`` now has a ``domain`` attribute to match the |
CM |
105 |
new WebOb 1.3 API. Its value is ``example.com``. |
|
106 |
|
073e52
|
107 |
Bug Fixes |
CM |
108 |
--------- |
3c95b1
|
109 |
|
480366
|
110 |
- Fix the ``pcreate`` script so that when the target directory name ends with a |
BL |
111 |
slash it does not produce a non-working project directory structure. |
|
112 |
Previously saying ``pcreate -s starter /foo/bar/`` produced different output |
073e52
|
113 |
than saying ``pcreate -s starter /foo/bar``. The former did not work |
CM |
114 |
properly. |
|
115 |
|
480366
|
116 |
- Fix the ``principals_allowed_by_permission`` method of |
BL |
117 |
``ACLAuthorizationPolicy`` so it anticipates a callable ``__acl__`` |
678f49
|
118 |
on resources. Previously it did not try to call the ``__acl__`` |
CM |
119 |
if it was callable. |
|
120 |
|
97f366
|
121 |
- The ``pviews`` script did not work when a url required custom request |
MM |
122 |
methods in order to perform traversal. Custom methods and descriptors added |
|
123 |
via ``pyramid.config.Configurator.add_request_method`` will now be present, |
|
124 |
allowing traversal to continue. |
|
125 |
See https://github.com/Pylons/pyramid/issues/1104 |
|
126 |
|
422366
|
127 |
- Remove unused ``renderer`` argument from ``Configurator.add_route``. |
CM |
128 |
|
42f0cb
|
129 |
- Allow the ``BasicAuthenticationPolicy`` to work with non-ascii usernames |
MM |
130 |
and passwords. The charset is not passed as part of the header and different |
|
131 |
browsers alternate between UTF-8 and Latin-1, so the policy now attempts |
|
132 |
to decode with UTF-8 first, and will fallback to Latin-1. |
|
133 |
See https://github.com/Pylons/pyramid/pull/1170 |
5065a5
|
134 |
|
642239
|
135 |
- The ``@view_defaults`` now apply to notfound and forbidden views |
MM |
136 |
that are defined as methods of a decorated class. |
|
137 |
See https://github.com/Pylons/pyramid/issues/1173 |
|
138 |
|
5065a5
|
139 |
Documentation |
PE |
140 |
------------- |
|
141 |
|
|
142 |
- Added a "Quick Tutorial" to go with the Quick Tour |
|
143 |
|
480366
|
144 |
- Removed mention of ``pyramid_beaker`` from docs. Beaker is no longer |
66be39
|
145 |
maintained. Point people at ``pyramid_redis_sessions`` instead. |
CM |
146 |
|
b04ae5
|
147 |
- Add documentation for ``pyramid.interfaces.IRendererFactory`` and |
MM |
148 |
``pyramid.interfaces.IRenderer``. |
|
149 |
|
af5fa0
|
150 |
Backwards Incompatibilities |
MM |
151 |
--------------------------- |
|
152 |
|
|
153 |
- The key/values in the ``_query`` parameter of ``request.route_url`` and the |
|
154 |
``query`` parameter of ``request.resource_url`` (and their variants), used |
|
155 |
to encode a value of ``None`` as the string ``'None'``, leaving the resulting |
|
156 |
query string to be ``a=b&key=None``. The value is now dropped in this |
79d9d6
|
157 |
situation, leaving a query string of ``a=b&key=``. |
af5fa0
|
158 |
See https://github.com/Pylons/pyramid/issues/1119 |
MM |
159 |
|
b04ae5
|
160 |
Deprecations |
MM |
161 |
------------ |
|
162 |
|
d7550c
|
163 |
- Deprecate the ``pyramid.interfaces.ITemplateRenderer`` interface. It was |
CM |
164 |
ill-defined and became unused when Mako and Chameleon template bindings were |
|
165 |
split into their own packages. |
|
166 |
|
480366
|
167 |
- The ``pyramid.session.UnencryptedCookieSessionFactoryConfig`` API has been |
BL |
168 |
deprecated and is superseded by the |
d79087
|
169 |
``pyramid.session.SignedCookieSessionFactory``. Note that while the cookies |
CM |
170 |
generated by the ``UnencryptedCookieSessionFactoryConfig`` |
|
171 |
are compatible with cookies generated by old releases, cookies generated by |
480366
|
172 |
the SignedCookieSessionFactory are not. See |
d79087
|
173 |
https://github.com/Pylons/pyramid/pull/1142 |
b04ae5
|
174 |
|
0184b5
|
175 |
- The ``pyramid.security.has_permission`` API is now deprecated. Instead, use |
CM |
176 |
the newly-added ``has_permission`` method of the request object. |
|
177 |
|
|
178 |
- The ``pyramid.security.effective_principals`` API is now deprecated. |
|
179 |
Instead, use the newly-added ``effective_principals`` attribute of the |
|
180 |
request object. |
|
181 |
|
|
182 |
- The ``pyramid.security.authenticated_userid`` API is now deprecated. |
|
183 |
Instead, use the newly-added ``authenticated_userid`` attribute of the |
|
184 |
request object. |
|
185 |
|
|
186 |
- The ``pyramid.security.unauthenticated_userid`` API is now deprecated. |
|
187 |
Instead, use the newly-added ``unauthenticated_userid`` attribute of the |
|
188 |
request object. |
|
189 |
|
767e44
|
190 |
Dependencies |
CM |
191 |
------------ |
|
192 |
|
|
193 |
- Pyramid now depends on WebOb>=1.3 (it uses ``webob.cookies.CookieProfile`` |
|
194 |
from 1.3+). |
|
195 |
|
78b41e
|
196 |
1.5a2 (2013-09-22) |
CM |
197 |
================== |
f6f1d1
|
198 |
|
c390f4
|
199 |
Features |
BJR |
200 |
-------- |
|
201 |
|
cbcd4d
|
202 |
- Users can now provide dotted Python names to as the ``factory`` argument |
480366
|
203 |
the Configurator methods named ``add_{view,route,subscriber}_predicate`` |
BL |
204 |
(instead of passing the predicate factory directly, you can pass a |
cbcd4d
|
205 |
dotted name which refers to the factory). |
c390f4
|
206 |
|
c062d5
|
207 |
Bug Fixes |
DH |
208 |
--------- |
|
209 |
|
f504cc
|
210 |
- Fix an exception in ``pyramid.path.package_name`` when resolving the package |
CM |
211 |
name for namespace packages that had no ``__file__`` attribute. |
c062d5
|
212 |
|
f6f1d1
|
213 |
Backwards Incompatibilities |
MM |
214 |
--------------------------- |
|
215 |
|
0778ee
|
216 |
- Pyramid no longer depends on or configures the Mako and Chameleon templating |
CM |
217 |
system renderers by default. Disincluding these templating systems by |
|
218 |
default means that the Pyramid core has fewer dependencies and can run on |
|
219 |
future platforms without immediate concern for the compatibility of its |
|
220 |
templating add-ons. It also makes maintenance slightly more effective, as |
|
221 |
different people can maintain the templating system add-ons that they |
|
222 |
understand and care about without needing commit access to the Pyramid core, |
|
223 |
and it allows users who just don't want to see any packages they don't use |
|
224 |
come along for the ride when they install Pyramid. |
82f970
|
225 |
|
0778ee
|
226 |
This means that upon upgrading to Pyramid 1.5a2+, projects that use either |
CM |
227 |
of these templating systems will see a traceback that ends something like |
|
228 |
this when their application attempts to render a Chameleon or Mako template:: |
|
229 |
|
|
230 |
ValueError: No such renderer factory .pt |
|
231 |
|
|
232 |
Or:: |
|
233 |
|
|
234 |
ValueError: No such renderer factory .mako |
|
235 |
|
|
236 |
Or:: |
|
237 |
|
|
238 |
ValueError: No such renderer factory .mak |
|
239 |
|
480366
|
240 |
Support for Mako templating has been moved into an add-on package named |
BL |
241 |
``pyramid_mako``, and support for Chameleon templating has been moved into |
|
242 |
an add-on package named ``pyramid_chameleon``. These packages are drop-in |
|
243 |
replacements for the old built-in support for these templating langauges. |
0778ee
|
244 |
All you have to do is install them and make them active in your configuration |
CM |
245 |
to register renderer factories for ``.pt`` and/or ``.mako`` (or ``.mak``) to |
|
246 |
make your application work again. |
|
247 |
|
|
248 |
To re-add support for Chameleon and/or Mako template renderers into your |
|
249 |
existing projects, follow the below steps. |
|
250 |
|
|
251 |
If you depend on Mako templates: |
|
252 |
|
|
253 |
* Make sure the ``pyramid_mako`` package is installed. One way to do this |
|
254 |
is by adding ``pyramid_mako`` to the ``install_requires`` section of your |
|
255 |
package's ``setup.py`` file and afterwards rerunning ``setup.py develop``:: |
ce138c
|
256 |
|
MM |
257 |
setup( |
|
258 |
#... |
|
259 |
install_requires=[ |
|
260 |
'pyramid_mako', # new dependency |
|
261 |
'pyramid', |
|
262 |
#... |
|
263 |
], |
|
264 |
) |
82f970
|
265 |
|
480366
|
266 |
* Within the portion of your application which instantiates a Pyramid |
BL |
267 |
``pyramid.config.Configurator`` (often the ``main()`` function in |
|
268 |
your project's ``__init__.py`` file), tell Pyramid to include the |
0778ee
|
269 |
``pyramid_mako`` includeme:: |
82f970
|
270 |
|
0778ee
|
271 |
config = Configurator(.....) |
CM |
272 |
config.include('pyramid_mako') |
|
273 |
|
|
274 |
If you depend on Chameleon templates: |
|
275 |
|
|
276 |
* Make sure the ``pyramid_chameleon`` package is installed. One way to do |
|
277 |
this is by adding ``pyramid_chameleon`` to the ``install_requires`` section |
480366
|
278 |
of your package's ``setup.py`` file and afterwards rerunning |
0778ee
|
279 |
``setup.py develop``:: |
CM |
280 |
|
|
281 |
setup( |
|
282 |
#... |
|
283 |
install_requires=[ |
|
284 |
'pyramid_chameleon', # new dependency |
|
285 |
'pyramid', |
|
286 |
#... |
|
287 |
], |
|
288 |
) |
|
289 |
|
480366
|
290 |
* Within the portion of your application which instantiates a Pyramid |
BL |
291 |
``~pyramid.config.Configurator`` (often the ``main()`` function in |
|
292 |
your project's ``__init__.py`` file), tell Pyramid to include the |
0778ee
|
293 |
``pyramid_chameleon`` includeme:: |
CM |
294 |
|
|
295 |
config = Configurator(.....) |
82f970
|
296 |
config.include('pyramid_chameleon') |
MM |
297 |
|
0778ee
|
298 |
Note that it's also fine to install these packages into *older* Pyramids for |
CM |
299 |
forward compatibility purposes. Even if you don't upgrade to Pyramid 1.5 |
|
300 |
immediately, performing the above steps in a Pyramid 1.4 installation is |
|
301 |
perfectly fine, won't cause any difference, and will give you forward |
|
302 |
compatibility when you eventually do upgrade to Pyramid 1.5. |
9ed074
|
303 |
|
0778ee
|
304 |
With the removal of Mako and Chameleon support from the core, some |
480366
|
305 |
unit tests that use the ``pyramid.renderers.render*`` methods may begin to |
BL |
306 |
fail. If any of your unit tests are invoking either |
0778ee
|
307 |
``pyramid.renderers.render()`` or ``pyramid.renderers.render_to_response()`` |
480366
|
308 |
with either Mako or Chameleon templates then the |
0778ee
|
309 |
``pyramid.config.Configurator`` instance in effect during |
CM |
310 |
the unit test should be also be updated to include the addons, as shown |
|
311 |
above. For example:: |
9ed074
|
312 |
|
0778ee
|
313 |
class ATest(unittest.TestCase): |
CM |
314 |
def setUp(self): |
|
315 |
self.config = pyramid.testing.setUp() |
|
316 |
self.config.include('pyramid_mako') |
82f970
|
317 |
|
0778ee
|
318 |
def test_it(self): |
CM |
319 |
result = pyramid.renderers.render('mypkg:templates/home.mako', {}) |
|
320 |
|
|
321 |
Or:: |
|
322 |
|
|
323 |
class ATest(unittest.TestCase): |
|
324 |
def setUp(self): |
|
325 |
self.config = pyramid.testing.setUp() |
|
326 |
self.config.include('pyramid_chameleon') |
|
327 |
|
|
328 |
def test_it(self): |
|
329 |
result = pyramid.renderers.render('mypkg:templates/home.pt', {}) |
|
330 |
|
|
331 |
- If you're using the Pyramid debug toolbar, when you upgrade Pyramid to |
480366
|
332 |
1.5a2+, you'll also need to upgrade the ``pyramid_debugtoolbar`` package to |
BL |
333 |
at least version 1.0.8, as older toolbar versions are not compatible with |
|
334 |
Pyramid 1.5a2+ due to the removal of Mako support from the core. It's |
0778ee
|
335 |
fine to use this newer version of the toolbar code with older Pyramids too. |
ec0c5c
|
336 |
|
f6f1d1
|
337 |
- Removed the ``request.response_*`` varying attributes. These attributes |
MM |
338 |
have been deprecated since Pyramid 1.1, and as per the deprecation policy, |
|
339 |
have now been removed. |
|
340 |
|
480366
|
341 |
- ``request.response`` will no longer be mutated when using the |
BL |
342 |
``pyramid.renderers.render()`` API. Almost all renderers mutate the |
fbdc3a
|
343 |
``request.response`` response object (for example, the JSON renderer sets |
MM |
344 |
``request.response.content_type`` to ``application/json``), but this is |
|
345 |
only necessary when the renderer is generating a response; it was a bug |
|
346 |
when it was done as a side effect of calling ``pyramid.renderers.render()``. |
f504cc
|
347 |
|
CM |
348 |
- Removed the ``bfg2pyramid`` fixer script. |
|
349 |
|
480366
|
350 |
- The ``pyramid.events.NewResponse`` event is now sent **after** response |
fc477b
|
351 |
callbacks are executed. It previously executed before response callbacks |
CM |
352 |
were executed. Rationale: it's more useful to be able to inspect the response |
|
353 |
after response callbacks have done their jobs instead of before. |
|
354 |
|
2c4f4e
|
355 |
- Removed the class named ``pyramid.view.static`` that had been deprecated |
CM |
356 |
since Pyramid 1.1. Instead use ``pyramid.static.static_view`` with |
|
357 |
``use_subpath=True`` argument. |
|
358 |
|
780bbf
|
359 |
- Removed the ``pyramid.view.is_response`` function that had been deprecated |
CM |
360 |
since Pyramid 1.1. Use the ``pyramid.request.Request.is_response`` method |
|
361 |
instead. |
|
362 |
|
fdf30b
|
363 |
- Removed the ability to pass the following arguments to |
6c4293
|
364 |
``pyramid.config.Configurator.add_route``: ``view``, ``view_context``. |
fdf30b
|
365 |
``view_for``, ``view_permission``, ``view_renderer``, and ``view_attr``. |
CM |
366 |
Using these arguments had been deprecated since Pyramid 1.1. Instead of |
|
367 |
passing view-related arguments to ``add_route``, use a separate call to |
|
368 |
``pyramid.config.Configurator.add_view`` to associate a view with a route |
|
369 |
using its ``route_name`` argument. Note that this impacts the |
|
370 |
``pyramid.config.Configurator.add_static_view`` function too, because it |
|
371 |
delegates to ``add_route``. |
|
372 |
|
8fe57d
|
373 |
- Removed the ability to influence and query a ``pyramid.request.Request`` |
CM |
374 |
object as if it were a dictionary. Previously it was possible to use methods |
|
375 |
like ``__getitem__``, ``get``, ``items``, and other dictlike methods to |
|
376 |
access values in the WSGI environment. This behavior had been deprecated |
|
377 |
since Pyramid 1.1. Use methods of ``request.environ`` (a real dictionary) |
|
378 |
instead. |
|
379 |
|
95e971
|
380 |
- Removed ancient backwards compatibily hack in |
CM |
381 |
``pyramid.traversal.DefaultRootFactory`` which populated the ``__dict__`` of |
|
382 |
the factory with the matchdict values for compatibility with BFG 0.9. |
|
383 |
|
c6601f
|
384 |
- The ``renderer_globals_factory`` argument to the |
CM |
385 |
``pyramid.config.Configurator` constructor and its ``setup_registry`` method |
|
386 |
has been removed. The ``set_renderer_globals_factory`` method of |
|
387 |
``pyramid.config.Configurator`` has also been removed. The (internal) |
|
388 |
``pyramid.interfaces.IRendererGlobals`` interface was also removed. These |
|
389 |
arguments, methods and interfaces had been deprecated since 1.1. Use a |
|
390 |
``BeforeRender`` event subscriber as documented in the "Hooks" chapter of the |
|
391 |
Pyramid narrative documentation instead of providing renderer globals values |
|
392 |
to the configurator. |
|
393 |
|
75f385
|
394 |
Deprecations |
CM |
395 |
------------ |
|
396 |
|
|
397 |
- The ``pyramid.config.Configurator.set_request_property`` method now issues |
|
398 |
a deprecation warning when used. It had been docs-deprecated in 1.4 |
|
399 |
but did not issue a deprecation warning when used. |
|
400 |
|
00bb95
|
401 |
1.5a1 (2013-08-30) |
CM |
402 |
================== |
2d9314
|
403 |
|
MM |
404 |
Features |
|
405 |
-------- |
|
406 |
|
c5ed54
|
407 |
- A new http exception subclass named ``pyramid.httpexceptions.HTTPSuccessful`` |
CM |
408 |
was added. You can use this class as the ``context`` of an exception |
480366
|
409 |
view to catch all 200-series "exceptions" (e.g. "raise HTTPOk"). This |
c5ed54
|
410 |
also allows you to catch *only* the ``HTTPOk`` exception itself; previously |
480366
|
411 |
this was impossible because a number of other exceptions |
c5ed54
|
412 |
(such as ``HTTPNoContent``) inherited from ``HTTPOk``, but now they do not. |
CM |
413 |
|
0a4aed
|
414 |
- You can now generate "hybrid" urldispatch/traversal URLs more easily |
480366
|
415 |
by using the new ``route_name``, ``route_kw`` and ``route_remainder_name`` |
c29603
|
416 |
arguments to ``request.resource_url`` and ``request.resource_path``. See |
480366
|
417 |
the new section of the "Combining Traversal and URL Dispatch" documentation |
c29603
|
418 |
chapter entitled "Hybrid URL Generation". |
0a4aed
|
419 |
|
480366
|
420 |
- It is now possible to escape double braces in Pyramid scaffolds (unescaped, |
1930eb
|
421 |
these represent replacement values). You can use ``\{\{a\}\}`` to |
480366
|
422 |
represent a "bare" ``{{a}}``. See |
1930eb
|
423 |
https://github.com/Pylons/pyramid/pull/862 |
CM |
424 |
|
330164
|
425 |
- Add ``localizer`` and ``locale_name`` properties (reified) to the request. |
480366
|
426 |
See https://github.com/Pylons/pyramid/issues/508. Note that the |
330164
|
427 |
``pyramid.i18n.get_localizer`` and ``pyramid.i18n.get_locale_name`` functions |
CM |
428 |
now simply look up these properties on the request. |
c614ff
|
429 |
|
b210ce
|
430 |
- Add ``pdistreport`` script, which prints the Python version in use, the |
CM |
431 |
Pyramid version in use, and the version number and location of all Python |
|
432 |
distributions currently installed. |
|
433 |
|
32333e
|
434 |
- Add the ability to invert the result of any view, route, or subscriber |
CM |
435 |
predicate using the ``not_`` class. For example:: |
|
436 |
|
|
437 |
from pyramid.config import not_ |
|
438 |
|
|
439 |
@view_config(route_name='myroute', request_method=not_('POST')) |
|
440 |
def myview(request): ... |
|
441 |
|
|
442 |
The above example will ensure that the view is called if the request method |
|
443 |
is not POST (at least if no other view is more specific). |
|
444 |
|
5e8ead
|
445 |
The ``pyramid.config.not_`` class can be used against any value that is |
32333e
|
446 |
a predicate value passed in any of these contexts: |
CM |
447 |
|
|
448 |
- ``pyramid.config.Configurator.add_view`` |
|
449 |
|
|
450 |
- ``pyramid.config.Configurator.add_route`` |
|
451 |
|
|
452 |
- ``pyramid.config.Configurator.add_subscriber`` |
|
453 |
|
|
454 |
- ``pyramid.view.view_config`` |
|
455 |
|
|
456 |
- ``pyramid.events.subscriber`` |
|
457 |
|
a17863
|
458 |
- ``scripts/prequest.py``: add support for submitting ``PUT`` and ``PATCH`` |
CM |
459 |
requests. See https://github.com/Pylons/pyramid/pull/1033. add support for |
0d96b7
|
460 |
submitting ``OPTIONS`` and ``PROPFIND`` requests, and allow users to specify |
a17863
|
461 |
basic authentication credentials in the request via a ``--login`` argument to |
CM |
462 |
the script. See https://github.com/Pylons/pyramid/pull/1039. |
f0f92b
|
463 |
|
2d9314
|
464 |
- ``ACLAuthorizationPolicy`` supports ``__acl__`` as a callable. This |
MM |
465 |
removes the ambiguity between the potential ``AttributeError`` that would |
|
466 |
be raised on the ``context`` when the property was not defined and the |
|
467 |
``AttributeError`` that could be raised from any user-defined code within |
|
468 |
a dynamic property. It is recommended to define a dynamic ACL as a callable |
|
469 |
to avoid this ambiguity. See https://github.com/Pylons/pyramid/issues/735. |
|
470 |
|
ff41f8
|
471 |
- Allow a protocol-relative URL (e.g. ``//example.com/images``) to be passed to |
WS |
472 |
``pyramid.config.Configurator.add_static_view``. This allows |
|
473 |
externally-hosted static URLs to be generated based on the current protocol. |
|
474 |
|
a1f768
|
475 |
- The ``AuthTktAuthenticationPolicy`` has two new options to configure its |
480366
|
476 |
domain usage: |
58c5fe
|
477 |
|
a1f768
|
478 |
* ``parent_domain``: if set the authentication cookie is set on |
WA |
479 |
the parent domain. This is useful if you have multiple sites sharing the |
|
480 |
same domain. |
|
481 |
* ``domain``: if provided the cookie is always set for this domain, bypassing |
58c5fe
|
482 |
all usual logic. |
TL |
483 |
|
3ea788
|
484 |
See https://github.com/Pylons/pyramid/pull/1028, |
TL |
485 |
https://github.com/Pylons/pyramid/pull/1072 and |
|
486 |
https://github.com/Pylons/pyramid/pull/1078. |
188aa7
|
487 |
|
23a7c6
|
488 |
- The ``AuthTktAuthenticationPolicy`` now supports IPv6 addresses when using |
MM |
489 |
the ``include_ip=True`` option. This is possibly incompatible with |
|
490 |
alternative ``auth_tkt`` implementations, as the specification does not |
|
491 |
define how to properly handle IPv6. See |
|
492 |
https://github.com/Pylons/pyramid/issues/831. |
|
493 |
|
38844f
|
494 |
- Make it possible to use variable arguments via |
MM |
495 |
``pyramid.paster.get_appsettings``. This also allowed the generated |
|
496 |
``initialize_db`` script from the ``alchemy`` scaffold to grow support |
|
497 |
for options in the form ``a=1 b=2`` so you can fill in |
|
498 |
values in a parameterized ``.ini`` file, e.g. |
|
499 |
``initialize_myapp_db etc/development.ini a=1 b=2``. |
|
500 |
See https://github.com/Pylons/pyramid/pull/911 |
|
501 |
|
fab845
|
502 |
- The ``request.session.check_csrf_token()`` method and the ``check_csrf`` view |
CM |
503 |
predicate now take into account the value of the HTTP header named |
|
504 |
``X-CSRF-Token`` (as well as the ``csrf_token`` form parameter, which they |
|
505 |
always did). The header is tried when the form parameter does not exist. |
|
506 |
|
b6a4d4
|
507 |
- View lookup will now search for valid views based on the inheritance |
MM |
508 |
hierarchy of the context. It tries to find views based on the most |
|
509 |
specific context first, and upon predicate failure, will move up the |
|
510 |
inheritance chain to test views found by the super-type of the context. |
|
511 |
In the past, only the most specific type containing views would be checked |
|
512 |
and if no matching view could be found then a PredicateMismatch would be |
|
513 |
raised. Now predicate mismatches don't hide valid views registered on |
5e8ead
|
514 |
super-types. Here's an example that now works:: |
9e1e6d
|
515 |
|
b6a4d4
|
516 |
class IResource(Interface): |
07c189
|
517 |
|
b6a4d4
|
518 |
... |
9e1e6d
|
519 |
|
b6a4d4
|
520 |
@view_config(context=IResource) |
MM |
521 |
def get(context, request): |
07c189
|
522 |
|
b6a4d4
|
523 |
... |
9e1e6d
|
524 |
|
b6a4d4
|
525 |
@view_config(context=IResource, request_method='POST') |
MM |
526 |
def post(context, request): |
07c189
|
527 |
|
b6a4d4
|
528 |
... |
9e1e6d
|
529 |
|
b6a4d4
|
530 |
@view_config(context=IResource, request_method='DELETE') |
MM |
531 |
def delete(context, request): |
07c189
|
532 |
|
b6a4d4
|
533 |
... |
9e1e6d
|
534 |
|
e01b1c
|
535 |
@implementer(IResource) |
b6a4d4
|
536 |
class MyResource: |
07c189
|
537 |
|
b6a4d4
|
538 |
... |
MM |
539 |
|
|
540 |
@view_config(context=MyResource, request_method='POST') |
|
541 |
def override_post(context, request): |
07c189
|
542 |
|
b6a4d4
|
543 |
... |
9e1e6d
|
544 |
|
AL |
545 |
Previously the override_post view registration would hide the get |
|
546 |
and delete views in the context of MyResource -- leading to a |
|
547 |
predicate mismatch error when trying to use GET or DELETE |
|
548 |
methods. Now the views are found and no predicate mismatch is |
|
549 |
raised. |
6b9700
|
550 |
See https://github.com/Pylons/pyramid/pull/786 and |
75fc4a
|
551 |
https://github.com/Pylons/pyramid/pull/1004 and |
MM |
552 |
https://github.com/Pylons/pyramid/pull/1046 |
9e1e6d
|
553 |
|
137748
|
554 |
- The ``pserve`` command now takes a ``-v`` (or ``--verbose``) flag and a |
CM |
555 |
``-q`` (or ``--quiet``) flag. Output from running ``pserve`` can be |
|
556 |
controlled using these flags. ``-v`` can be specified multiple times to |
|
557 |
increase verbosity. ``-q`` sets verbosity to ``0`` unconditionally. The |
|
558 |
default verbosity level is ``1``. |
|
559 |
|
986dc5
|
560 |
- The ``alchemy`` scaffold tests now provide better coverage. See |
CM |
561 |
https://github.com/Pylons/pyramid/pull/1029 |
|
562 |
|
d07d16
|
563 |
- The ``pyramid.config.Configurator.add_route`` method now supports being |
CM |
564 |
called with an external URL as pattern. See |
480366
|
565 |
https://github.com/Pylons/pyramid/issues/611 and the documentation section |
67674f
|
566 |
in the "URL Dispatch" chapter entitled "External Routes" for more information. |
8a8eff
|
567 |
|
0d96b7
|
568 |
Bug Fixes |
CM |
569 |
--------- |
|
570 |
|
97ed56
|
571 |
- It was not possible to use ``pyramid.httpexceptions.HTTPException`` as |
CM |
572 |
the ``context`` of an exception view as very general catchall for |
480366
|
573 |
http-related exceptions when you wanted that exception view to override the |
97ed56
|
574 |
default exception view. See https://github.com/Pylons/pyramid/issues/985 |
CM |
575 |
|
480366
|
576 |
- When the ``pyramid.reload_templates`` setting was true, and a Chameleon |
BL |
577 |
template was reloaded, and the renderer specification named a macro |
8a7e80
|
578 |
(e.g. ``foo#macroname.pt``), renderings of the template after the template |
480366
|
579 |
was reloaded due to a file change would produce the entire template body |
BL |
580 |
instead of just a rendering of the macro. See |
8a7e80
|
581 |
https://github.com/Pylons/pyramid/issues/1013. |
CM |
582 |
|
480366
|
583 |
- Fix an obscure problem when combining a virtual root with a route with a |
ece96f
|
584 |
``*traverse`` in its pattern. Now the traversal path generated in |
CM |
585 |
such a configuration will be correct, instead of an element missing |
|
586 |
a leading slash. |
|
587 |
|
24c932
|
588 |
- Fixed a Mako renderer bug returning a tuple with a previous defname value |
3de54e
|
589 |
in some circumstances. See https://github.com/Pylons/pyramid/issues/1037 |
BL |
590 |
for more information. |
24c932
|
591 |
|
0d96b7
|
592 |
- Make the ``pyramid.config.assets.PackageOverrides`` object implement the API |
CM |
593 |
for ``__loader__`` objects specified in PEP 302. Proxies to the |
|
594 |
``__loader__`` set by the importer, if present; otherwise, raises |
|
595 |
``NotImplementedError``. This makes Pyramid static view overrides work |
|
596 |
properly under Python 3.3 (previously they would not). See |
|
597 |
https://github.com/Pylons/pyramid/pull/1015 for more information. |
|
598 |
|
|
599 |
- ``mako_templating``: added defensive workaround for non-importability of |
|
600 |
``mako`` due to upstream ``markupsafe`` dropping Python 3.2 support. Mako |
|
601 |
templating will no longer work under the combination of MarkupSafe 0.17 and |
|
602 |
Python 3.2 (although the combination of MarkupSafe 0.17 and Python 3.3 or any |
|
603 |
supported Python 2 version will work OK). |
|
604 |
|
ea278e
|
605 |
- Spaces and dots may now be in mako renderer template paths. This was |
MM |
606 |
broken when support for the new makodef syntax was added in 1.4a1. |
|
607 |
See https://github.com/Pylons/pyramid/issues/950 |
|
608 |
|
20c57e
|
609 |
- ``pyramid.debug_authorization=true`` will now correctly print out |
MM |
610 |
``Allowed`` for views registered with ``NO_PERMISSION_REQUIRED`` instead |
|
611 |
of invoking the ``permits`` method of the authorization policy. |
|
612 |
See https://github.com/Pylons/pyramid/issues/954 |
|
613 |
|
c35b29
|
614 |
- Pyramid failed to install on some systems due to being packaged with |
MM |
615 |
some test files containing higher order characters in their names. These |
|
616 |
files have now been removed. See |
|
617 |
https://github.com/Pylons/pyramid/issues/981 |
|
618 |
|
050b71
|
619 |
- ``pyramid.testing.DummyResource`` didn't define ``__bool__``, so code under |
0d96b7
|
620 |
Python 3 would use ``__len__`` to find truthiness; this usually caused an |
CM |
621 |
instance of DummyResource to be "falsy" instead of "truthy". See |
|
622 |
https://github.com/Pylons/pyramid/pull/1032 |
050b71
|
623 |
|
0a8d50
|
624 |
- The ``alchemy`` scaffold would break when the database was MySQL during |
CM |
625 |
tables creation. See https://github.com/Pylons/pyramid/pull/1049 |
|
626 |
|
6a4a34
|
627 |
- The ``current_route_url`` method now attaches the query string to the URL by |
JV |
628 |
default. See |
0f1bc5
|
629 |
https://github.com/Pylons/pyramid/issues/1040 |
33e0fe
|
630 |
|
d6e8b8
|
631 |
- Make ``pserve.cherrypy_server_runner`` Python 3 compatible. See |
TL |
632 |
https://github.com/Pylons/pyramid/issues/718 |
|
633 |
|
33e0fe
|
634 |
Backwards Incompatibilities |
JV |
635 |
--------------------------- |
|
636 |
|
6a4a34
|
637 |
- Modified the ``current_route_url`` method in pyramid.Request. The method |
JV |
638 |
previously returned the URL without the query string by default, it now does |
|
639 |
attach the query string unless it is overriden. |
0f1bc5
|
640 |
|
480366
|
641 |
- The ``route_url`` and ``route_path`` APIs no longer quote ``/`` |
58951c
|
642 |
to ``%2F`` when a replacement value contains a ``/``. This was pointless, |
480366
|
643 |
as WSGI servers always unquote the slash anyway, and Pyramid never sees the |
58951c
|
644 |
quoted value. |
CM |
645 |
|
480366
|
646 |
- It is no longer possible to set a ``locale_name`` attribute of the request, |
330164
|
647 |
nor is it possible to set a ``localizer`` attribute of the request. These |
CM |
648 |
are now "reified" properties that look up a locale name and localizer |
|
649 |
respectively using the machinery described in the "Internationalization" |
|
650 |
chapter of the documentation. |
|
651 |
|
db0185
|
652 |
- If you send an ``X-Vhm-Root`` header with a value that ends with a slash (or |
CM |
653 |
any number of slashes), the trailing slash(es) will be removed before a URL |
|
654 |
is generated when you use use ``request.resource_url`` or |
|
655 |
``request.resource_path``. Previously the virtual root path would not have |
|
656 |
trailing slashes stripped, which would influence URL generation. |
|
657 |
|
|
658 |
- The ``pyramid.interfaces.IResourceURL`` interface has now grown two new |
|
659 |
attributes: ``virtual_path_tuple`` and ``physical_path_tuple``. These should |
|
660 |
be the tuple form of the resource's path (physical and virtual). |
|
661 |
|