commit | author | age
|
9a66aa
|
1 |
Next release |
CM |
2 |
============ |
|
3 |
|
|
4 |
Features |
|
5 |
-------- |
|
6 |
|
5ec330
|
7 |
- The ``[pshell]`` section in an ini configuration file now treats a |
CM |
8 |
``setup`` key as a dotted name that points to a callable that is passed the |
|
9 |
bootstrap environment. It can mutate the environment as necessary for |
|
10 |
great justice. |
|
11 |
|
473697
|
12 |
- A new configuration setting named ``pyramid.includes`` is now available. |
CM |
13 |
It is described in the "Environment Variables and ``.ini`` Files Settings" |
|
14 |
narrative documentation chapter. |
|
15 |
|
83bf91
|
16 |
- Added a ``route_prefix`` argument to the |
CM |
17 |
``pyramid.config.Configurator.include`` method. This argument allows you |
|
18 |
to compose URL dispatch applications together. See the section entitled |
|
19 |
"Using a Route Prefix to Compose Applications" in the "URL Dispatch" |
|
20 |
narrative documentation chapter. |
|
21 |
|
1e88db
|
22 |
- Added a ``pyramid.security.NO_PERMISSION_REQUIRED`` constant for use in |
CM |
23 |
``permission=`` statements to view configuration. This constant has a |
|
24 |
value of the string ``__no_permission_required__``. This string value was |
|
25 |
previously referred to in documentation; now the documentation uses the |
|
26 |
constant. |
|
27 |
|
1f901a
|
28 |
- Added a decorator-based way to configure a response adapter: |
CM |
29 |
``pyramid.response.response_adapter``. This decorator has the same use as |
|
30 |
``pyramid.config.Configurator.add_response_adapter`` but it's declarative. |
|
31 |
|
9a66aa
|
32 |
- The ``pyramid.events.BeforeRender`` event now has an attribute named |
CM |
33 |
``rendering_val``. This can be used to introspect the value returned by a |
|
34 |
view in a BeforeRender subscriber. |
|
35 |
|
6b2a62
|
36 |
- New configurator directive: ``pyramid.config.Configurator.add_tween``. |
CM |
37 |
This directive adds a "tween". A "tween" is used to wrap the Pyramid |
|
38 |
router's primary request handling function. This is a feature may be used |
|
39 |
by Pyramid framework extensions, to provide, for example, view timing |
|
40 |
support and as a convenient place to hang bookkeeping code. |
af2323
|
41 |
|
6b2a62
|
42 |
Tweens are further described in the narrative docs section in the Hooks |
CM |
43 |
chapter, named "Registering Tweens". |
af2323
|
44 |
|
6b2a62
|
45 |
- New paster command ``paster ptweens``, which prints the current "tween" |
CM |
46 |
configuration for an application. See the section entitled "Displaying |
|
47 |
Tweens" in the Command-Line Pyramid chapter of the narrative documentation |
|
48 |
for more info. |
b72379
|
49 |
|
3a8054
|
50 |
- The Pyramid debug logger now uses the standard logging configuration |
CM |
51 |
(usually set up by Paste as part of startup). This means that output from |
|
52 |
e.g. ``debug_notfound``, ``debug_authorization``, etc. will go to the |
|
53 |
normal logging channels. The logger name of the debug logger will be the |
|
54 |
package name of the *caller* of the Configurator's constructor. |
|
55 |
|
95a379
|
56 |
- A new attribute is available on request objects: ``exc_info``. Its value |
CM |
57 |
will be ``None`` until an exception is caught by the Pyramid router, after |
|
58 |
which it will be the result of ``sys.exc_info()``. |
6b2a62
|
59 |
|
274435
|
60 |
- ``pyramid.testing.DummyRequest`` now implements the |
CM |
61 |
``add_finished_callback`` and ``add_response_callback`` methods. |
|
62 |
|
1a42bd
|
63 |
- New methods of the ``pyramid.config.Configurator`` class: |
CM |
64 |
``set_authentication_policy`` and ``set_authorization_policy``. These are |
|
65 |
meant to be consumed mostly by add-on authors. |
|
66 |
|
ea824f
|
67 |
- New Configurator method: ``set_root_factory``. |
CM |
68 |
|
|
69 |
- Pyramid no longer eagerly commits some default configuration statements at |
|
70 |
Configurator construction time, which permits values passed in as |
|
71 |
constructor arguments (e.g. ``authentication_policy`` and |
|
72 |
``authorization_policy``) to override the same settings obtained via an |
|
73 |
"include". |
|
74 |
|
9f7f4f
|
75 |
- Better Mako rendering exceptions via |
CM |
76 |
``pyramid.mako_templating.MakoRenderingException`` |
|
77 |
|
5c6963
|
78 |
- New request methods: ``current_route_url``, ``current_route_path``, and |
CM |
79 |
``static_path``. |
12cef0
|
80 |
|
5c6963
|
81 |
- New functions in ``pyramid.url``: ``current_route_path`` and |
CM |
82 |
``static_path``. |
12cef0
|
83 |
|
b8c797
|
84 |
- The ``pyramid.request.Request.static_url`` API (and its brethren |
CM |
85 |
``pyramid.request.Request.static_path``, ``pyramid.url.static_url``, and |
|
86 |
``pyramid.url.static_path``) now accept an asbolute filename as a "path" |
|
87 |
argument. This will generate a URL to an asset as long as the filename is |
|
88 |
in a directory which was previously registered as a static view. |
|
89 |
Previously, trying to generate a URL to an asset using an absolute file |
|
90 |
path would raise a ValueError. |
|
91 |
|
449287
|
92 |
- The ``RemoteUserAuthenticationPolicy ``, ``AuthTktAuthenticationPolicy``, |
CM |
93 |
and ``SessionAuthenticationPolicy`` constructors now accept an additional |
|
94 |
keyword argument named ``debug``. By default, this keyword argument is |
|
95 |
``False``. When it is ``True``, debug information will be sent to the |
|
96 |
Pyramid debug logger (usually on stderr) when the ``authenticated_userid`` |
|
97 |
or ``effective_principals`` method is called on any of these policies. The |
|
98 |
output produced can be useful when trying to diagnose |
|
99 |
authentication-related problems. |
|
100 |
|
6b2a62
|
101 |
Internal |
CM |
102 |
-------- |
|
103 |
|
|
104 |
- The Pyramid "exception view" machinery is now implemented as a "tween" |
|
105 |
(``pyramid.tweens.excview_tween_factory``). |
95a379
|
106 |
|
85093d
|
107 |
- WSGIHTTPException (HTTPFound, HTTPNotFound, etc) now has a new API named |
CM |
108 |
"prepare" which renders the body and content type when it is provided with |
|
109 |
a WSGI environ. Required for debug toolbar. |
|
110 |
|
|
111 |
- Once ``__call__`` or ``prepare`` is called on a WSGIHTTPException, the body |
|
112 |
will be set, and subsequent calls to ``__call__`` will always return the |
|
113 |
same body. Delete the body attribute to rerender the exception body. |
|
114 |
|
5c52da
|
115 |
- Previously the ``pyramid.events.BeforeRender`` event *wrapped* a dictionary |
CM |
116 |
(it addressed it as its ``_system`` attribute). Now it *is* a dictionary |
|
117 |
(it inherits from ``dict``), and it's the value that is passed to templates |
|
118 |
as a top-level dictionary. |
|
119 |
|
fb90f0
|
120 |
- The ``route_url``, ``route_path``, ``resource_url``, ``static_url``, and |
CM |
121 |
``current_route_url`` functions in the ``pyramid.url`` package now delegate |
|
122 |
to a method on the request they've been passed, instead of the other way |
|
123 |
around. The pyramid.request.Request object now inherits from a mixin named |
|
124 |
pyramid.url.URLMethodsMixin to make this possible, and all url/path |
|
125 |
generation logic is embedded in this mixin. |
|
126 |
|
5bf23f
|
127 |
- Refactor ``pyramid.config`` into a package. |
CM |
128 |
|
66da9b
|
129 |
- Removed the ``_set_security_policies`` method of the Configurator. |
CM |
130 |
|
ef6f6b
|
131 |
Deprecations |
CM |
132 |
------------ |
|
133 |
|
|
134 |
- All Pyramid-related deployment settings (e.g. ``debug_all``, |
|
135 |
``debug_notfound``) are now meant to be prefixed with the prefix |
|
136 |
``pyramid.``. For example: ``debug_all`` -> ``pyramid.debug_all``. The |
|
137 |
old non-prefixed settings will continue to work indefinitely but supplying |
|
138 |
them may print a deprecation warning. All scaffolds and tutorials have |
|
139 |
been changed to use prefixed settings. |
|
140 |
|
b5ffe3
|
141 |
- The ``settings`` dictionary now raises a deprecation warning when you |
CM |
142 |
attempt to access its values via ``__getattr__`` instead of |
|
143 |
via ``__getitem__``. |
|
144 |
|
3a8054
|
145 |
Backwards Incompatibilities |
CM |
146 |
--------------------------- |
|
147 |
|
|
148 |
- If a string is passed as the ``debug_logger`` parameter to a Configurator, |
|
149 |
that string is considered to be the name of a global Python logger rather |
|
150 |
than a dotted name to an instance of a logger. |
|
151 |
|
83bf91
|
152 |
- The ``pyramid.config.Configurator.include`` method now accepts only a |
CM |
153 |
single ``callable`` argument (a sequence of callables used to be |
|
154 |
permitted). If you are passing more than one ``callable`` to |
|
155 |
``pyramid.config.Configurator.include``, it will break. You now must now |
|
156 |
instead make a separate call to the method for each callable. |
|
157 |
|
6b2a62
|
158 |
Documentation |
CM |
159 |
------------- |
|
160 |
|
fb90f0
|
161 |
- Narrative and API documentation which used the ``route_url``, |
CM |
162 |
``route_path``, ``resource_url``, ``static_url``, and ``current_route_url`` |
|
163 |
functions in the ``pyramid.url`` package have now been changed to use |
|
164 |
eponymous methods of the request instead. |
|
165 |
|
83bf91
|
166 |
- Added a section entitled "Using a Route Prefix to Compose Applications" to |
CM |
167 |
the "URL Dispatch" narrative documentation chapter. |
|
168 |
|
6b2a62
|
169 |
- Added a new module to the API docs: ``pyramid.tweens``. |
CM |
170 |
|
|
171 |
- Added a "Registering Tweens" section to the "Hooks" narrative chapter. |
|
172 |
|
|
173 |
- Added a "Displaying Tweens" section to the "Command-Line Pyramid" narrative |
|
174 |
chapter. |
|
175 |
|
473697
|
176 |
- Added documentation for the ``pyramid.tweens`` and ``pyramid.includes`` |
CM |
177 |
configuration settings to the "Environment Variables and ``.ini`` Files |
|
178 |
Settings" chapter. |
|
179 |
|
1ae7af
|
180 |
- Added a Logging chapter to the narrative docs (based on the Pylons logging |
CM |
181 |
docs, thanks Phil). |
|
182 |
|
5c52da
|
183 |
- Added the ``pyramid.interfaces.IDict`` interface representing the methods |
CM |
184 |
of a dictionary, for documentation purposes only (IMultiDict and |
|
185 |
IBeforeRender inherit from it). |
|
186 |
|
42d31c
|
187 |
- All tutorials now use - The ``route_url``, ``route_path``, |
CM |
188 |
``resource_url``, ``static_url``, and ``current_route_url`` methods of the |
|
189 |
request rather than the function variants imported from ``pyramid.url``. |
|
190 |
|
b25335
|
191 |
- The ZODB wiki tutorial now uses the ``pyramid_zodbconn`` package rather |
CM |
192 |
than the ``repoze.zodbconn`` package to provide ZODB integration. |
|
193 |
|
eef972
|
194 |
Dependency Changes |
CM |
195 |
------------------ |
|
196 |
|
|
197 |
- Pyramid now relies on PasteScript >= 1.7.4. This version contains a |
|
198 |
feature important for allowing flexible logging configuration. |
|
199 |
|
391402
|
200 |
Scaffolds |
CM |
201 |
---------- |
|
202 |
|
|
203 |
- All scaffolds now use the ``pyramid_tm`` package rather than the |
|
204 |
``repoze.tm2`` middleware to manage transaction management. |
|
205 |
|
b25335
|
206 |
- The ZODB scaffold now uses the ``pyramid_zodbconn`` package rather than the |
CM |
207 |
``repoze.zodbconn`` package to provide ZODB integration. |
|
208 |
|
391402
|
209 |
- All scaffolds now use the ``pyramid_debugtoolbar`` package rather than the |
CM |
210 |
``WebError`` package to provide interactive debugging features. |
|
211 |
|
|
212 |
- Projects created via a scaffold no longer depend on the ``WebError`` |
|
213 |
package at all; configuration in the ``production.ini`` file which used to |
|
214 |
require its ``error_catcher`` middleware has been removed. Configuring |
|
215 |
error catching / email sending is now the domain of the ``pyramid_exclog`` |
|
216 |
package (see https://docs.pylonsproject.org/projects/pyramid_exclog/dev/). |
|
217 |
|
1939d0
|
218 |
Bug Fixes |
CM |
219 |
--------- |
|
220 |
|
|
221 |
- Fixed an issue with the default renderer not working at certain times. See |
|
222 |
https://github.com/Pylons/pyramid/issues/249 |
|
223 |
|
8c0344
|
224 |
1.1 (2011-07-22) |
CM |
225 |
================ |
ead3c7
|
226 |
|
aa2fe1
|
227 |
Features |
CM |
228 |
-------- |
|
229 |
|
|
230 |
- Added the ``pyramid.renderers.null_renderer`` object as an API. The null |
|
231 |
renderer is an object that can be used in advanced integration cases as |
|
232 |
input to the view configuration ``renderer=`` argument. When the null |
|
233 |
renderer is used as a view renderer argument, Pyramid avoids converting the |
|
234 |
view callable result into a Response object. This is useful if you want to |
|
235 |
reuse the view configuration and lookup machinery outside the context of |
|
236 |
its use by the Pyramid router. This feature was added for consumption by |
|
237 |
the ``pyramid_rpc`` package, which uses view configuration and lookup |
|
238 |
outside the context of a router in exactly this way. ``pyramid_rpc`` has |
|
239 |
been broken under 1.1 since 1.1b1; adding it allows us to make it work |
|
240 |
again. |
|
241 |
|
39e88a
|
242 |
- Change all scaffolding templates that point to docs.pylonsproject.org to |
CM |
243 |
use ``/projects/pyramid/current`` rather than ``/projects/pyramid/dev``. |
|
244 |
|
e7cb93
|
245 |
Internals |
CM |
246 |
--------- |
|
247 |
|
|
248 |
- Remove ``compat`` code that served only the purpose of providing backwards |
|
249 |
compatibility with Python 2.4. |
|
250 |
|
73c0ae
|
251 |
- Add a deprecation warning for non-API function |
CM |
252 |
``pyramid.renderers.renderer_from_name`` which has seen use in the wild. |
|
253 |
|
|
254 |
- Add a ``clone`` method to ``pyramid.renderers.RendererHelper`` for use by |
|
255 |
the ``pyramid.view.view_config`` decorator. |
|
256 |
|
ead3c7
|
257 |
Documentation |
CM |
258 |
------------- |
|
259 |
|
|
260 |
- Fixed two typos in wiki2 (SQLA + URL Dispatch) tutorial. |
|
261 |
|
8cb682
|
262 |
- Reordered chapters in narrative section for better new user friendliness. |
CM |
263 |
|
|
264 |
- Added more indexing markers to sections in documentation. |
|
265 |
|
40c643
|
266 |
1.1b4 (2011-07-18) |
CM |
267 |
================== |
5fb458
|
268 |
|
CM |
269 |
Documentation |
|
270 |
------------- |
|
271 |
|
|
272 |
- Added a section entitled "Writing a Script" to the "Command-Line Pyramid" |
|
273 |
chapter. |
|
274 |
|
f06ce6
|
275 |
Backwards Incompatibilities |
CM |
276 |
--------------------------- |
|
277 |
|
|
278 |
- We added the ``pyramid.scripting.make_request`` API too hastily in 1.1b3. |
|
279 |
It has been removed. Sorry for any inconvenience. Use the |
|
280 |
``pyramid.request.Request.blank`` API instead. |
|
281 |
|
95df42
|
282 |
Features |
CM |
283 |
-------- |
|
284 |
|
af0560
|
285 |
- The ``paster pshell``, ``paster pviews``, and ``paster proutes`` commands |
CM |
286 |
each now under the hood uses ``pyramid.paster.bootstrap``, which makes it |
|
287 |
possible to supply an ``.ini`` file without naming the "right" section in |
|
288 |
the file that points at the actual Pyramid application. Instead, you can |
|
289 |
generally just run ``paster {pshell|proutes|pviews} development.ini`` and |
|
290 |
it will do mostly the right thing. |
95df42
|
291 |
|
4b3ba9
|
292 |
Bug Fixes |
CM |
293 |
--------- |
|
294 |
|
|
295 |
- Omit custom environ variables when rendering a custom exception template in |
|
296 |
``pyramid.httpexceptions.WSGIHTTPException._set_default_attrs``; |
|
297 |
stringifying thse may trigger code that should not be executed; see |
|
298 |
https://github.com/Pylons/pyramid/issues/239 |
|
299 |
|
999d44
|
300 |
1.1b3 (2011-07-15) |
CM |
301 |
================== |
2ad827
|
302 |
|
CM |
303 |
Features |
|
304 |
-------- |
|
305 |
|
|
306 |
- Fix corner case to ease semifunctional testing of views: create a new |
|
307 |
rendererinfo to clear out old registry on a rescan. See |
|
308 |
https://github.com/Pylons/pyramid/pull/234. |
|
309 |
|
56d0fe
|
310 |
- New API class: ``pyramid.static.static_view``. This supersedes the |
100a57
|
311 |
deprecated ``pyramid.view.static`` class. ``pyramid.static.static_view`` |
CM |
312 |
by default serves up documents as the result of the request's |
|
313 |
``path_info``, attribute rather than it's ``subpath`` attribute (the |
|
314 |
inverse was true of ``pyramid.view.static``, and still is). |
|
315 |
``pyramid.static.static_view`` exposes a ``use_subpath`` flag for use when |
10408c
|
316 |
you want the static view to behave like the older deprecated version. |
56d0fe
|
317 |
|
c515d7
|
318 |
- A new API function ``pyramid.paster.bootstrap`` has been added to make |
CM |
319 |
writing scripts that bootstrap a Pyramid environment easier, e.g.:: |
|
320 |
|
|
321 |
from pyramid.paster import bootstrap |
|
322 |
info = bootstrap('/path/to/my/development.ini') |
|
323 |
request = info['request'] |
|
324 |
print request.route_url('myroute') |
|
325 |
|
|
326 |
- A new API function ``pyramid.scripting.prepare`` has been added. It is a |
|
327 |
lower-level analogue of ``pyramid.paster.boostrap`` that accepts a request |
|
328 |
and a registry instead of a config file argument, and is used for the same |
|
329 |
purpose:: |
|
330 |
|
|
331 |
from pyramid.scripting import prepare |
|
332 |
info = prepare(registry=myregistry) |
|
333 |
request = info['request'] |
|
334 |
print request.route_url('myroute') |
|
335 |
|
|
336 |
- A new API function ``pyramid.scripting.make_request`` has been added. The |
|
337 |
resulting request will have a ``registry`` attribute. It is meant to be |
|
338 |
used in conjunction with ``pyramid.scripting.prepare`` and/or |
|
339 |
``pyramid.paster.bootstrap`` (both of which accept a request as an |
|
340 |
argument):: |
|
341 |
|
|
342 |
from pyramid.scripting import make_request |
|
343 |
request = make_request('/') |
|
344 |
|
|
345 |
- New API attribute ``pyramid.config.global_registries`` is an iterable |
|
346 |
object that contains references to every Pyramid registry loaded into the |
|
347 |
current process via ``pyramid.config.Configurator.make_app``. It also has |
|
348 |
a ``last`` attribute containing the last registry loaded. This is used by |
|
349 |
the scripting machinery, and is available for introspection. |
|
350 |
|
56d0fe
|
351 |
Deprecations |
CM |
352 |
------------ |
|
353 |
|
|
354 |
- The ``pyramid.view.static`` class has been deprecated in favor of the newer |
|
355 |
``pyramid.static.static_view`` class. A deprecation warning is raised when |
|
356 |
it is used. You should replace it with a reference to |
|
357 |
``pyramid.static.static_view`` with the ``use_subpath=True`` argument. |
|
358 |
|
5b5cd6
|
359 |
Bug Fixes |
CM |
360 |
--------- |
|
361 |
|
|
362 |
- Without a mo-file loaded for the combination of domain/locale, |
|
363 |
``pyramid.i18n.Localizer.pluralize`` run using that domain/locale |
acc2d3
|
364 |
combination raised an inscrutable "translations object has no attr |
CM |
365 |
'plural'" error. Now, instead it "works" (it uses a germanic pluralization |
|
366 |
by default). It's nonsensical to try to pluralize something without |
|
367 |
translations for that locale/domain available, but this behavior matches |
|
368 |
the behavior of ``pyramid.i18n.Localizer.translate`` so it's at least |
|
369 |
consistent; see https://github.com/Pylons/pyramid/issues/235. |
5b5cd6
|
370 |
|
d4ccb8
|
371 |
1.1b2 (2011-07-13) |
CM |
372 |
================== |
82efa4
|
373 |
|
e573d4
|
374 |
Features |
CM |
375 |
-------- |
|
376 |
|
|
377 |
- New environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and new |
|
378 |
configuration file value ``prevent_http_cache``. These are synomymous and |
|
379 |
allow you to prevent HTTP cache headers from being set by Pyramid's |
|
380 |
``http_cache`` machinery globally in a process. see the "Influencing HTTP |
|
381 |
Caching" section of the "View Configuration" narrative chapter and the |
|
382 |
detailed documentation for this setting in the "Environment Variables and |
|
383 |
Configuration Settings" narrative chapter. |
|
384 |
|
82efa4
|
385 |
Behavior Changes |
CM |
386 |
---------------- |
|
387 |
|
|
388 |
- Previously, If a ``BeforeRender`` event subscriber added a value via the |
|
389 |
``__setitem__`` or ``update`` methods of the event object with a key that |
|
390 |
already existed in the renderer globals dictionary, a ``KeyError`` was |
|
391 |
raised. With the deprecation of the "add_renderer_globals" feature of the |
|
392 |
configurator, there was no way to override an existing value in the |
|
393 |
renderer globals dictionary that already existed. Now, the event object |
|
394 |
will overwrite an older value that is already in the globals dictionary |
|
395 |
when its ``__setitem__`` or ``update`` is called (as well as the new |
|
396 |
``setdefault`` method), just like a plain old dictionary. As a result, for |
|
397 |
maximum interoperability with other third-party subscribers, if you write |
|
398 |
an event subscriber meant to be used as a BeforeRender subscriber, your |
|
399 |
subscriber code will now need to (using ``.get`` or ``__contains__`` of the |
|
400 |
event object) ensure no value already exists in the renderer globals |
|
401 |
dictionary before setting an overriding value. |
|
402 |
|
94ab24
|
403 |
Bug Fixes |
CM |
404 |
--------- |
|
405 |
|
|
406 |
- The ``Configurator.add_route`` method allowed two routes with the same |
|
407 |
route to be added without an intermediate ``config.commit()``. If you now |
|
408 |
receive a ``ConfigurationError`` at startup time that appears to be |
|
409 |
``add_route`` related, you'll need to either a) ensure that all of your |
|
410 |
route names are unique or b) call ``config.commit()`` before adding a |
|
411 |
second route with the name of a previously added name or c) use a |
|
412 |
Configurator that works in ``autocommit`` mode. |
|
413 |
|
aec6b2
|
414 |
- The ``pyramid_routesalchemy`` and ``pyramid_alchemy`` scaffolds |
CM |
415 |
inappropriately used ``DBSession.rollback()`` instead of |
|
416 |
``transaction.abort()`` in one place. |
|
417 |
|
d05117
|
418 |
- We now clear ``request.response`` before we invoke an exception view; an |
CM |
419 |
exception view will be working with a request.response that has not been |
|
420 |
touched by any code prior to the exception. |
|
421 |
|
873d9b
|
422 |
- Views associated with routes with spaces in the route name may not have |
CM |
423 |
been looked up correctly when using Pyramid with ``zope.interface`` 3.6.4 |
d4ccb8
|
424 |
and better. See https://github.com/Pylons/pyramid/issues/232. |
873d9b
|
425 |
|
aec6b2
|
426 |
Documentation |
CM |
427 |
------------- |
|
428 |
|
|
429 |
- Wiki2 (SQLAlchemy + URL Dispatch) tutorial ``models.initialize_sql`` didn't |
|
430 |
match the ``pyramid_routesalchemy`` scaffold function of the same name; it |
|
431 |
didn't get synchronized when it was changed in the scaffold. |
|
432 |
|
e573d4
|
433 |
- New documentation section in View Configuration narrative chapter: |
CM |
434 |
"Influencing HTTP Caching". |
|
435 |
|
a36fdb
|
436 |
1.1b1 (2011-07-10) |
CM |
437 |
================== |
0fa199
|
438 |
|
CM |
439 |
Features |
|
440 |
-------- |
|
441 |
|
756500
|
442 |
- It is now possible to invoke ``paster pshell`` even if the paste ini file |
CM |
443 |
section name pointed to in its argument is not actually a Pyramid WSGI |
|
444 |
application. The shell will work in a degraded mode, and will warn the |
|
445 |
user. See "The Interactive Shell" in the "Creating a Pyramid Project" |
|
446 |
narrative documentation section. |
|
447 |
|
|
448 |
- ``paster pshell`` now offers more built-in global variables by default |
|
449 |
(including ``app`` and ``settings``). See "The Interactive Shell" in the |
|
450 |
"Creating a Pyramid Project" narrative documentation section. |
|
451 |
|
|
452 |
- It is now possible to add a ``[pshell]`` section to your application's .ini |
|
453 |
configuration file, which influences the global names available to a pshell |
|
454 |
session. See "Extending the Shell" in the "Creating a Pyramid Project" |
|
455 |
narrative documentation chapter. |
|
456 |
|
fca1ef
|
457 |
- The ``config.scan`` method has grown a ``**kw`` argument. ``kw`` argument |
CM |
458 |
represents a set of keyword arguments to pass to the Venusian ``Scanner`` |
|
459 |
object created by Pyramid. (See the Venusian documentation for more |
|
460 |
information about ``Scanner``). |
|
461 |
|
6a0602
|
462 |
- New request property: ``json_body``. This property will return the |
CM |
463 |
JSON-decoded variant of the request body. If the request body is not |
|
464 |
well-formed JSON, this property will raise an exception. |
b78eff
|
465 |
|
0fa199
|
466 |
- A new value ``http_cache`` can be used as a view configuration |
CM |
467 |
parameter. |
|
468 |
|
|
469 |
When you supply an ``http_cache`` value to a view configuration, the |
|
470 |
``Expires`` and ``Cache-Control`` headers of a response generated by the |
|
471 |
associated view callable are modified. The value for ``http_cache`` may be |
|
472 |
one of the following: |
|
473 |
|
|
474 |
- A nonzero integer. If it's a nonzero integer, it's treated as a number |
|
475 |
of seconds. This number of seconds will be used to compute the |
|
476 |
``Expires`` header and the ``Cache-Control: max-age`` parameter of |
|
477 |
responses to requests which call this view. For example: |
|
478 |
``http_cache=3600`` instructs the requesting browser to 'cache this |
|
479 |
response for an hour, please'. |
|
480 |
|
|
481 |
- A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` |
|
482 |
instance, it will be converted into a number of seconds, and that number |
|
483 |
of seconds will be used to compute the ``Expires`` header and the |
|
484 |
``Cache-Control: max-age`` parameter of responses to requests which call |
|
485 |
this view. For example: ``http_cache=datetime.timedelta(days=1)`` |
|
486 |
instructs the requesting browser to 'cache this response for a day, |
|
487 |
please'. |
|
488 |
|
|
489 |
- Zero (``0``). If the value is zero, the ``Cache-Control`` and |
|
490 |
``Expires`` headers present in all responses from this view will be |
|
491 |
composed such that client browser cache (and any intermediate caches) are |
|
492 |
instructed to never cache the response. |
|
493 |
|
|
494 |
- A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, |
|
495 |
{'public':True})``), the first value in the tuple may be a nonzero |
|
496 |
integer or a ``datetime.timedelta`` instance; in either case this value |
|
497 |
will be used as the number of seconds to cache the response. The second |
|
498 |
value in the tuple must be a dictionary. The values present in the |
|
499 |
dictionary will be used as input to the ``Cache-Control`` response |
|
500 |
header. For example: ``http_cache=(3600, {'public':True})`` means 'cache |
|
501 |
for an hour, and add ``public`` to the Cache-Control header of the |
|
502 |
response'. All keys and values supported by the |
|
503 |
``webob.cachecontrol.CacheControl`` interface may be added to the |
|
504 |
dictionary. Supplying ``{'public':True}`` is equivalent to calling |
|
505 |
``response.cache_control.public = True``. |
|
506 |
|
|
507 |
Providing a non-tuple value as ``http_cache`` is equivalent to calling |
|
508 |
``response.cache_expires(value)`` within your view's body. |
|
509 |
|
|
510 |
Providing a two-tuple value as ``http_cache`` is equivalent to calling |
|
511 |
``response.cache_expires(value[0], **value[1])`` within your view's body. |
|
512 |
|
|
513 |
If you wish to avoid influencing, the ``Expires`` header, and instead wish |
|
514 |
to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` |
|
515 |
with the first element of ``None``, e.g.: ``(None, {'public':True})``. |
|
516 |
|
b44aab
|
517 |
Bug Fixes |
CM |
518 |
--------- |
|
519 |
|
|
520 |
- Framework wrappers of the original view (such as http_cached and so on) |
|
521 |
relied on being able to trust that the response they were receiving was an |
|
522 |
IResponse. It wasn't always, because the response was resolved by the |
|
523 |
router instead of early in the view wrapping process. This has been fixed. |
|
524 |
|
6a0602
|
525 |
Documentation |
CM |
526 |
------------- |
|
527 |
|
|
528 |
- Added a section in the "Webob" chapter named "Dealing With A JSON-Encoded |
|
529 |
Request Body" (usage of ``request.json_body``). |
|
530 |
|
756500
|
531 |
Behavior Changes |
CM |
532 |
---------------- |
|
533 |
|
|
534 |
- The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands |
|
535 |
now take a single argument in the form ``/path/to/config.ini#sectionname`` |
|
536 |
rather than the previous 2-argument spelling ``/path/to/config.ini |
|
537 |
sectionname``. ``#sectionname`` may be omitted, in which case ``#main`` is |
|
538 |
assumed. |
|
539 |
|
b9c0e7
|
540 |
1.1a4 (2011-07-01) |
CM |
541 |
================== |
9395f0
|
542 |
|
CM |
543 |
Bug Fixes |
|
544 |
--------- |
|
545 |
|
|
546 |
- ``pyramid.testing.DummyRequest`` now raises deprecation warnings when |
|
547 |
attributes deprecated for ``pyramid.request.Request`` are accessed (like |
|
548 |
``response_content_type``). This is for the benefit of folks running unit |
|
549 |
tests which use DummyRequest instead of a "real" request, so they know |
|
550 |
things are deprecated without necessarily needing a functional test suite. |
|
551 |
|
2ea5c1
|
552 |
- The ``pyramid.events.subscriber`` directive behaved contrary to the |
CM |
553 |
documentation when passed more than one interface object to its |
|
554 |
constructor. For example, when the following listener was registered:: |
|
555 |
|
|
556 |
@subscriber(IFoo, IBar) |
|
557 |
def expects_ifoo_events_and_ibar_events(event): |
|
558 |
print event |
|
559 |
|
|
560 |
The Events chapter docs claimed that the listener would be registered and |
|
561 |
listening for both ``IFoo`` and ``IBar`` events. Instead, it registered an |
|
562 |
"object event" subscriber which would only be called if an IObjectEvent was |
|
563 |
emitted where the object interface was ``IFoo`` and the event interface was |
|
564 |
``IBar``. |
|
565 |
|
|
566 |
The behavior now matches the documentation. If you were relying on the |
|
567 |
buggy behavior of the 1.0 ``subscriber`` directive in order to register an |
|
568 |
object event subscriber, you must now pass a sequence to indicate you'd |
8519c9
|
569 |
like to register a subscriber for an object event. e.g.:: |
2ea5c1
|
570 |
|
CM |
571 |
@subscriber([IFoo, IBar]) |
|
572 |
def expects_object_event(object, event): |
|
573 |
print object, event |
|
574 |
|
c1f3d0
|
575 |
Features |
CM |
576 |
-------- |
|
577 |
|
|
578 |
- Add JSONP renderer (see "JSONP renderer" in the Renderers chapter of the |
|
579 |
documentation). |
|
580 |
|
b7f33b
|
581 |
Deprecations |
CM |
582 |
------------ |
|
583 |
|
|
584 |
- Deprecated the ``set_renderer_globals_factory`` method of the Configurator |
|
585 |
and the ``renderer_globals`` Configurator constructor parameter. |
|
586 |
|
05a1b4
|
587 |
Documentation |
CM |
588 |
------------- |
|
589 |
|
6c9959
|
590 |
- The Wiki and Wiki2 tutorial "Tests" chapters each had two bugs: neither did |
CM |
591 |
told the user to depend on WebTest, and 2 tests failed in each as the |
|
592 |
result of changes to Pyramid itself. These issues have been fixed. |
05a1b4
|
593 |
|
e21ed8
|
594 |
- Move 1.0.X CHANGES.txt entries to HISTORY.txt. |
CM |
595 |
|
1ba6fe
|
596 |
1.1a3 (2011-06-26) |
CM |
597 |
================== |
05fd08
|
598 |
|
8bd6cf
|
599 |
Features |
CM |
600 |
-------- |
|
601 |
|
|
602 |
- Added ``mako.preprocessor`` config file parameter; allows for a Mako |
|
603 |
preprocessor to be specified as a Python callable or Python dotted name. |
|
604 |
See https://github.com/Pylons/pyramid/pull/183 for rationale. |
|
605 |
|
05fd08
|
606 |
Bug fixes |
CM |
607 |
--------- |
|
608 |
|
|
609 |
- Pyramid would raise an AttributeError in the Configurator when attempting |
|
610 |
to set a ``__text__`` attribute on a custom predicate that was actually a |
|
611 |
classmethod. See https://github.com/Pylons/pyramid/pull/217 . |
|
612 |
|
d8c55c
|
613 |
- Accessing or setting deprecated response_* attrs on request |
CM |
614 |
(e.g. ``response_content_type``) now issues a deprecation warning at access |
|
615 |
time rather than at rendering time. |
05fd08
|
616 |
|
cc85e7
|
617 |
1.1a2 (2011-06-22) |
CM |
618 |
================== |
c724f0
|
619 |
|
d74d53
|
620 |
Bug Fixes |
CM |
621 |
--------- |
|
622 |
|
|
623 |
- 1.1a1 broke Akhet by not providing a backwards compatibility import shim |
|
624 |
for ``pyramid.paster.PyramidTemplate``. Now one has been added, although a |
cc85e7
|
625 |
deprecation warning is emitted when Akhet imports it. |
d74d53
|
626 |
|
6ed33e
|
627 |
- If multiple specs were provided in a single call to |
CM |
628 |
``config.add_translation_dirs``, the directories were inserted into the |
|
629 |
beginning of the directory list in the wrong order: they were inserted in |
|
630 |
the reverse of the order they were provided in the ``*specs`` list (items |
4f11dc
|
631 |
later in the list were added before ones earlier in the list). This is now |
CM |
632 |
fixed. |
6ed33e
|
633 |
|
c724f0
|
634 |
Backwards Incompatibilities |
CM |
635 |
--------------------------- |
|
636 |
|
|
637 |
- The pyramid Router attempted to set a value into the key |
|
638 |
``environ['repoze.bfg.message']`` when it caught a view-related exception |
cc85e7
|
639 |
for backwards compatibility with applications written for ``repoze.bfg`` |
CM |
640 |
during error handling. It did this by using code that looked like so:: |
c724f0
|
641 |
|
CM |
642 |
# "why" is an exception object |
|
643 |
try: |
|
644 |
msg = why[0] |
|
645 |
except: |
|
646 |
msg = '' |
|
647 |
|
|
648 |
environ['repoze.bfg.message'] = msg |
|
649 |
|
|
650 |
Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in |
|
651 |
Pyramid 1.0. Our standing policy is to not remove features after a |
|
652 |
deprecation for two full major releases, so this code was originally slated |
|
653 |
to be removed in Pyramid 1.2. However, computing the |
|
654 |
``repoze.bfg.message`` value was the source of at least one bug found in |
|
655 |
the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a |
|
656 |
foolproof way to both preserve backwards compatibility and to fix the bug. |
|
657 |
Therefore, the code which sets the value has been removed in this release. |
|
658 |
Code in exception views which relies on this value's presence in the |
|
659 |
environment should now use the ``exception`` attribute of the request |
|
660 |
(e.g. ``request.exception[0]``) to retrieve the message instead of relying |
|
661 |
on ``request.environ['repoze.bfg.message']``. |
|
662 |
|
83549e
|
663 |
1.1a1 (2011-06-20) |
CM |
664 |
================== |
959523
|
665 |
|
8027ad
|
666 |
Documentation |
JD |
667 |
------------- |
|
668 |
|
af71c2
|
669 |
- The term "template" used to refer to both "paster templates" and "rendered |
CM |
670 |
templates" (templates created by a rendering engine. i.e. Mako, Chameleon, |
|
671 |
Jinja, etc.). "Paster templates" will now be refered to as "scaffolds", |
|
672 |
whereas the name for "rendered templates" will remain as "templates." |
8027ad
|
673 |
|
88f967
|
674 |
- The ``wiki`` (ZODB+Traversal) tutorial was updated slightly. |
CM |
675 |
|
|
676 |
- The ``wiki2`` (SQLA+URL Dispatch) tutorial was updated slightly. |
|
677 |
|
d2973d
|
678 |
- Make ``pyramid.interfaces.IAuthenticationPolicy`` and |
CM |
679 |
``pyramid.interfaces.IAuthorizationPolicy`` public interfaces, and refer to |
|
680 |
them within the ``pyramid.authentication`` and ``pyramid.authorization`` |
|
681 |
API docs. |
|
682 |
|
|
683 |
- Render the function definitions for each exposed interface in |
|
684 |
``pyramid.interfaces``. |
|
685 |
|
cae85d
|
686 |
- Add missing docs reference to |
CM |
687 |
``pyramid.config.Configurator.set_view_mapper`` and refer to it within |
|
688 |
Hooks chapter section named "Using a View Mapper". |
|
689 |
|
f6799b
|
690 |
- Added section to the "Environment Variables and ``.ini`` File Settings" |
CM |
691 |
chapter in the narrative documentation section entitled "Adding a Custom |
|
692 |
Setting". |
|
693 |
|
2a1c3f
|
694 |
- Added documentation for a "multidict" (e.g. the API of ``request.POST``) as |
CM |
695 |
interface API documentation. |
|
696 |
|
e725cf
|
697 |
- Added a section to the "URL Dispatch" narrative chapter regarding the new |
CM |
698 |
"static" route feature. |
|
699 |
|
2ce652
|
700 |
- Added "What's New in Pyramid 1.1" to HTML rendering of documentation. |
CM |
701 |
|
0ca4bb
|
702 |
- Added API docs for ``pyramid.authentication.SessionAuthenticationPolicy``. |
CM |
703 |
|
f8f08b
|
704 |
- Added API docs for ``pyramid.httpexceptions.exception_response``. |
1ffb8e
|
705 |
|
CM |
706 |
- Added "HTTP Exceptions" section to Views narrative chapter including a |
f8f08b
|
707 |
description of ``pyramid.httpexceptions.exception_response``. |
1ffb8e
|
708 |
|
fcbd7b
|
709 |
Features |
CM |
710 |
-------- |
4d9260
|
711 |
|
f3e62c
|
712 |
- Add support for language fallbacks: when trying to translate for a |
WA |
713 |
specific territory (such as ``en_GB``) fall back to translations |
|
714 |
for the language (ie ``en``). This brings the translation behaviour in line |
|
715 |
with GNU gettext and fixes partially translated texts when using C |
|
716 |
extensions. |
|
717 |
|
0ca4bb
|
718 |
- New authentication policy: |
CM |
719 |
``pyramid.authentication.SessionAuthenticationPolicy``, which uses a session |
|
720 |
to store credentials. |
|
721 |
|
4d9260
|
722 |
- Accessing the ``response`` attribute of a ``pyramid.request.Request`` |
CM |
723 |
object (e.g. ``request.response`` within a view) now produces a new |
|
724 |
``pyramid.response.Response`` object. This feature is meant to be used |
|
725 |
mainly when a view configured with a renderer needs to set response |
db51c0
|
726 |
attributes: all renderers will use the Response object implied by |
CM |
727 |
``request.response`` as the response object returned to the router. |
|
728 |
|
|
729 |
``request.response`` can also be used by code in a view that does not use a |
|
730 |
renderer, however the response object that is produced by |
|
731 |
``request.response`` must be returned when a renderer is not in play (it is |
|
732 |
not a "global" response). |
fcbd7b
|
733 |
|
CM |
734 |
- Integers and longs passed as ``elements`` to ``pyramid.url.resource_url`` |
|
735 |
or ``pyramid.request.Request.resource_url`` e.g. ``resource_url(context, |
|
736 |
request, 1, 2)`` (``1`` and ``2`` are the ``elements``) will now be |
|
737 |
converted implicitly to strings in the result. Previously passing integers |
|
738 |
or longs as elements would cause a TypeError. |
|
739 |
|
296ee2
|
740 |
- ``pyramid_alchemy`` paster template now uses ``query.get`` rather than |
CM |
741 |
``query.filter_by`` to take better advantage of identity map caching. |
|
742 |
|
|
743 |
- ``pyramid_alchemy`` paster template now has unit tests. |
|
744 |
|
2242e6
|
745 |
- Added ``pyramid.i18n.make_localizer`` API (broken out from |
CM |
746 |
``get_localizer`` guts). |
|
747 |
|
ba2ac1
|
748 |
- An exception raised by a NewRequest event subscriber can now be caught by |
CM |
749 |
an exception view. |
|
750 |
|
b32552
|
751 |
- It is now possible to get information about why Pyramid raised a Forbidden |
CM |
752 |
exception from within an exception view. The ``ACLDenied`` object returned |
|
753 |
by the ``permits`` method of each stock authorization policy |
|
754 |
(``pyramid.interfaces.IAuthorizationPolicy.permits``) is now attached to |
|
755 |
the Forbidden exception as its ``result`` attribute. Therefore, if you've |
|
756 |
created a Forbidden exception view, you can see the ACE, ACL, permission, |
|
757 |
and principals involved in the request as |
|
758 |
eg. ``context.result.permission``, ``context.result.acl``, etc within the |
|
759 |
logic of the Forbidden exception view. |
|
760 |
|
474df5
|
761 |
- Don't explicitly prevent the ``timeout`` from being lower than the |
CM |
762 |
``reissue_time`` when setting up an ``AuthTktAuthenticationPolicy`` |
|
763 |
(previously such a configuration would raise a ``ValueError``, now it's |
|
764 |
allowed, although typically nonsensical). Allowing the nonsensical |
|
765 |
configuration made the code more understandable and required fewer tests. |
|
766 |
|
99a32e
|
767 |
- A new paster command named ``paster pviews`` was added. This command |
CM |
768 |
prints a summary of potentially matching views for a given path. See the |
|
769 |
section entitled "Displaying Matching Views for a Given URL" in the "View |
|
770 |
Configuration" chapter of the narrative documentation for more information. |
|
771 |
|
e725cf
|
772 |
- The ``add_route`` method of the Configurator now accepts a ``static`` |
CM |
773 |
argument. If this argument is ``True``, the added route will never be |
|
774 |
considered for matching when a request is handled. Instead, it will only |
|
775 |
be useful for URL generation via ``route_url`` and ``route_path``. See the |
|
776 |
section entitled "Static Routes" in the URL Dispatch narrative chapter for |
|
777 |
more information. |
|
778 |
|
966b5c
|
779 |
- A default exception view for the context |
99edc5
|
780 |
``pyramid.interfaces.IExceptionResponse`` is now registered by default. |
CM |
781 |
This means that an instance of any exception response class imported from |
|
782 |
``pyramid.httpexceptions`` (such as ``HTTPFound``) can now be raised from |
|
783 |
within view code; when raised, this exception view will render the |
|
784 |
exception to a response. |
1ffb8e
|
785 |
|
f8f08b
|
786 |
- A function named ``pyramid.httpexceptions.exception_response`` is a |
CM |
787 |
shortcut that can be used to create HTTP exception response objects using |
|
788 |
an HTTP integer status code. |
1ffb8e
|
789 |
|
CM |
790 |
- The Configurator now accepts an additional keyword argument named |
966b5c
|
791 |
``exceptionresponse_view``. By default, this argument is populated with a |
CM |
792 |
default exception view function that will be used when a response is raised |
|
793 |
as an exception. When ``None`` is passed for this value, an exception view |
|
794 |
for responses will not be registered. Passing ``None`` returns the |
|
795 |
behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception |
|
796 |
will propagate to middleware and to the WSGI server). |
|
797 |
|
|
798 |
- The ``pyramid.request.Request`` class now has a ``ResponseClass`` interface |
|
799 |
which points at ``pyramid.response.Response``. |
|
800 |
|
8cbbd9
|
801 |
- The ``pyramid.response.Response`` class now has a ``RequestClass`` |
CM |
802 |
interface which points at ``pyramid.request.Request``. |
1ffb8e
|
803 |
|
d868ff
|
804 |
- It is now possible to return an arbitrary object from a Pyramid view |
CM |
805 |
callable even if a renderer is not used, as long as a suitable adapter to |
|
806 |
``pyramid.interfaces.IResponse`` is registered for the type of the returned |
1a6fc7
|
807 |
object by using the new |
CM |
808 |
``pyramid.config.Configurator.add_response_adapter`` API. See the section |
|
809 |
in the Hooks chapter of the documentation entitled "Changing How Pyramid |
|
810 |
Treats View Responses". |
df15ed
|
811 |
|
99edc5
|
812 |
- The Pyramid router will now, by default, call the ``__call__`` method of |
CM |
813 |
WebOb response objects when returning a WSGI response. This means that, |
|
814 |
among other things, the ``conditional_response`` feature of WebOb response |
|
815 |
objects will now behave properly. |
df15ed
|
816 |
|
920990
|
817 |
- New method named ``pyramid.request.Request.is_response``. This method |
CM |
818 |
should be used instead of the ``pyramid.view.is_response`` function, which |
|
819 |
has been deprecated. |
e39ddf
|
820 |
|
JG |
821 |
Bug Fixes |
|
822 |
--------- |
|
823 |
|
0fd8ea
|
824 |
- URL pattern markers used in URL dispatch are permitted to specify a custom |
CM |
825 |
regex. For example, the pattern ``/{foo:\d+}`` means to match ``/12345`` |
|
826 |
(foo==12345 in the match dictionary) but not ``/abc``. However, custom |
0a0edf
|
827 |
regexes in a pattern marker which used squiggly brackets did not work. For |
CM |
828 |
example, ``/{foo:\d{4}}`` would fail to match ``/1234`` and |
|
829 |
``/{foo:\d{1,2}}`` would fail to match ``/1`` or ``/11``. One level of |
|
830 |
inner squiggly brackets is now recognized so that the prior two patterns |
|
831 |
given as examples now work. See also |
|
832 |
https://github.com/Pylons/pyramid/issues/#issue/123. |
|
833 |
|
|
834 |
- Don't send port numbers along with domain information in cookies set by |
115c71
|
835 |
AuthTktCookieHelper (see https://github.com/Pylons/pyramid/issues/131). |
CM |
836 |
|
|
837 |
- ``pyramid.url.route_path`` (and the shortcut |
|
838 |
``pyramid.request.Request.route_url`` method) now include the WSGI |
b596e1
|
839 |
SCRIPT_NAME at the front of the path if it is not empty (see |
CM |
840 |
https://github.com/Pylons/pyramid/issues/135). |
|
841 |
|
|
842 |
- ``pyramid.testing.DummyRequest`` now has a ``script_name`` attribute (the |
0b2629
|
843 |
empty string). |
CM |
844 |
|
|
845 |
- Don't quote ``:@&+$,`` symbols in ``*elements`` passed to |
|
846 |
``pyramid.url.route_url`` or ``pyramid.url.resource_url`` (see |
|
847 |
https://github.com/Pylons/pyramid/issues#issue/141). |
|
848 |
|
|
849 |
- Include SCRIPT_NAME in redirects issued by |
|
850 |
``pyramid.view.append_slash_notfound_view`` (see |
|
851 |
https://github.com/Pylons/pyramid/issues#issue/149). |
|
852 |
|
|
853 |
- Static views registered with ``config.add_static_view`` which also included |
|
854 |
a ``permission`` keyword argument would not work as expected, because |
|
855 |
``add_static_view`` also registered a route factory internally. Because a |
|
856 |
route factory was registered internally, the context checked by the Pyramid |
8af47b
|
857 |
permission machinery never had an ACL. ``add_static_view`` no longer |
CM |
858 |
registers a route with a factory, so the default root factory will be used. |
|
859 |
|
|
860 |
- ``config.add_static_view`` now passes extra keyword arguments it receives |
|
861 |
to ``config.add_route`` (calling add_static_view is mostly logically |
|
862 |
equivalent to adding a view of the type ``pyramid.static.static_view`` |
|
863 |
hooked up to a route with a subpath). This makes it possible to pass e.g., |
29a850
|
864 |
``factory=`` to ``add_static_view`` to protect a particular static view |
CM |
865 |
with a custom ACL. |
|
866 |
|
|
867 |
- ``testing.DummyRequest`` used the wrong registry (the global registry) as |
|
868 |
``self.registry`` if a dummy request was created *before* ``testing.setUp`` |
|
869 |
was executed (``testing.setUp`` pushes a local registry onto the |
|
870 |
threadlocal stack). Fixed by implementing ``registry`` as a property for |
|
871 |
DummyRequest instead of eagerly assigning an attribute. |
|
872 |
See also https://github.com/Pylons/pyramid/issues/165 |
|
873 |
|
ba0a5f
|
874 |
- When visiting a URL that represented a static view which resolved to a |
CM |
875 |
subdirectory, the ``index.html`` of that subdirectory would not be served |
|
876 |
properly. Instead, a redirect to ``/subdir`` would be issued. This has |
|
877 |
been fixed, and now visiting a subdirectory that contains an ``index.html`` |
|
878 |
within a static view returns the index.html properly. See also |
|
879 |
https://github.com/Pylons/pyramid/issues/67. |
|
880 |
|
4d9260
|
881 |
- Redirects issued by a static view did not take into account any existing |
CM |
882 |
``SCRIPT_NAME`` (such as one set by a url mapping composite). Now they do. |
|
883 |
|
|
884 |
- The ``pyramid.wsgi.wsgiapp2`` decorator did not take into account the |
|
885 |
``SCRIPT_NAME`` in the origin request. |
|
886 |
|
|
887 |
- The ``pyramid.wsgi.wsgiapp2`` decorator effectively only worked when it |
|
888 |
decorated a view found via traversal; it ignored the ``PATH_INFO`` that was |
|
889 |
part of a url-dispatch-matched view. |
|
890 |
|
|
891 |
Deprecations |
|
892 |
------------ |
|
893 |
|
|
894 |
- Deprecated all assignments to ``request.response_*`` attributes (for |
|
895 |
example ``request.response_content_type = 'foo'`` is now deprecated). |
ed7ffe
|
896 |
Assignments and mutations of assignable request attributes that were |
CM |
897 |
considered by the framework for response influence are now deprecated: |
|
898 |
``response_content_type``, ``response_headerlist``, ``response_status``, |
|
899 |
``response_charset``, and ``response_cache_for``. Instead of assigning |
|
900 |
these to the request object for later detection by the rendering machinery, |
|
901 |
users should use the appropriate API of the Response object created by |
|
902 |
accessing ``request.response`` (e.g. code which does |
|
903 |
``request.response_content_type = 'abc'`` should be changed to |
|
904 |
``request.response.content_type = 'abc'``). |
|
905 |
|
|
906 |
- Passing view-related parameters to |
|
907 |
``pyramid.config.Configurator.add_route`` is now deprecated. Previously, a |
|
908 |
view was permitted to be connected to a route using a set of ``view*`` |
|
909 |
parameters passed to the ``add_route`` method of the Configurator. This |
|
910 |
was a shorthand which replaced the need to perform a subsequent call to |
|
911 |
``add_view``. For example, it was valid (and often recommended) to do:: |
|
912 |
|
|
913 |
config.add_route('home', '/', view='mypackage.views.myview', |
|
914 |
view_renderer='some/renderer.pt') |
|
915 |
|
bf8c8f
|
916 |
Passing ``view*`` arguments to ``add_route`` is now deprecated in favor of |
CM |
917 |
connecting a view to a predefined route via ``Configurator.add_view`` using |
|
918 |
the route's ``route_name`` parameter. As a result, the above example |
ed7ffe
|
919 |
should now be spelled:: |
CM |
920 |
|
f426e5
|
921 |
config.add_route('home', '/') |
CM |
922 |
config.add_view('mypackage.views.myview', route_name='home') |
|
923 |
renderer='some/renderer.pt') |
|
924 |
|
|
925 |
This deprecation was done to reduce confusion observed in IRC, as well as |
|
926 |
to (eventually) reduce documentation burden (see also |
|
927 |
https://github.com/Pylons/pyramid/issues/164). A deprecation warning is |
|
928 |
now issued when any view-related parameter is passed to |
|
929 |
``Configurator.add_route``. |
|
930 |
|
|
931 |
- Passing an ``environ`` dictionary to the ``__call__`` method of a |
|
932 |
"traverser" (e.g. an object that implements |
|
933 |
``pyramid.interfaces.ITraverser`` such as an instance of |
|
934 |
``pyramid.traversal.ResourceTreeTraverser``) as its ``request`` argument |
|
935 |
now causes a deprecation warning to be emitted. Consumer code should pass a |
|
936 |
``request`` object instead. The fact that passing an environ dict is |
|
937 |
permitted has been documentation-deprecated since ``repoze.bfg`` 1.1, and |
|
938 |
this capability will be removed entirely in a future version. |
|
939 |
|
|
940 |
- The following (undocumented, dictionary-like) methods of the |
4d9260
|
941 |
``pyramid.request.Request`` object have been deprecated: ``__contains__``, |
CM |
942 |
``__delitem__``, ``__getitem__``, ``__iter__``, ``__setitem__``, ``get``, |
|
943 |
``has_key``, ``items``, ``iteritems``, ``itervalues``, ``keys``, ``pop``, |
|
944 |
``popitem``, ``setdefault``, ``update``, and ``values``. Usage of any of |
|
945 |
these methods will cause a deprecation warning to be emitted. These |
|
946 |
methods were added for internal compatibility in ``repoze.bfg`` 1.1 (code |
|
947 |
that currently expects a request object expected an environ object in BFG |
|
948 |
1.0 and before). In a future version, these methods will be removed |
|
949 |
entirely. |
|
950 |
|
920990
|
951 |
- Deprecated ``pyramid.view.is_response`` function in favor of (newly-added) |
CM |
952 |
``pyramid.request.Request.is_response`` method. Determining if an object |
|
953 |
is truly a valid response object now requires access to the registry, which |
|
954 |
is only easily available as a request attribute. The |
|
955 |
``pyramid.view.is_response`` function will still work until it is removed, |
|
956 |
but now may return an incorrect answer under some (very uncommon) |
|
957 |
circumstances. |
|
958 |
|
4d9260
|
959 |
Behavior Changes |
CM |
960 |
---------------- |
|
961 |
|
18b25a
|
962 |
- The default Mako renderer is now configured to escape all HTML in |
MM |
963 |
expression tags. This is intended to help prevent XSS attacks caused by |
|
964 |
rendering unsanitized input from users. To revert this behavior in user's |
|
965 |
templates, they need to filter the expression through the 'n' filter. |
|
966 |
For example, ${ myhtml | n }. |
|
967 |
See https://github.com/Pylons/pyramid/issues/193. |
|
968 |
|
99edc5
|
969 |
- A custom request factory is now required to return a request object that |
4d9260
|
970 |
has a ``response`` attribute (or "reified"/lazy property) if they the |
CM |
971 |
request is meant to be used in a view that uses a renderer. This |
|
972 |
``response`` attribute should be an instance of the class |
|
973 |
``pyramid.response.Response``. |
|
974 |
|
|
975 |
- The JSON and string renderer factories now assign to |
|
976 |
``request.response.content_type`` rather than |
bf7544
|
977 |
``request.response_content_type``. |
CM |
978 |
|
|
979 |
- Each built-in renderer factory now determines whether it should change the |
|
980 |
content type of the response by comparing the response's content type |
|
981 |
against the response's default content type; if the content type is the |
|
982 |
default content type (usually ``text/html``), the renderer changes the |
|
983 |
content type (to ``application/json`` or ``text/plain`` for JSON and string |
|
984 |
renderers respectively). |
4d9260
|
985 |
|
ba0a5f
|
986 |
- The ``pyramid.wsgi.wsgiapp2`` now uses a slightly different method of |
CM |
987 |
figuring out how to "fix" ``SCRIPT_NAME`` and ``PATH_INFO`` for the |
|
988 |
downstream application. As a result, those values may differ slightly from |
|
989 |
the perspective of the downstream application (for example, ``SCRIPT_NAME`` |
|
990 |
will now never possess a trailing slash). |
|
991 |
|
bca03f
|
992 |
- Previously, ``pyramid.request.Request`` inherited from |
CM |
993 |
``webob.request.Request`` and implemented ``__getattr__``, ``__setattr__`` |
|
994 |
and ``__delattr__`` itself in order to overidde "adhoc attr" WebOb behavior |
|
995 |
where attributes of the request are stored in the environ. Now, |
|
996 |
``pyramid.request.Request`` object inherits from (the more recent) |
|
997 |
``webob.request.BaseRequest`` instead of ``webob.request.Request``, which |
|
998 |
provides the same behavior. ``pyramid.request.Request`` no longer |
|
999 |
implements its own ``__getattr__``, ``__setattr__`` or ``__delattr__`` as a |
|
1000 |
result. |
|
1001 |
|
966b5c
|
1002 |
- ``pyramid.response.Response`` is now a *subclass* of |
99edc5
|
1003 |
``webob.response.Response`` (in order to directly implement the |
CM |
1004 |
``pyramid.interfaces.IResponse`` interface). |
|
1005 |
|
53d11e
|
1006 |
- The "exception response" objects importable from ``pyramid.httpexceptions`` |
CM |
1007 |
(e.g. ``HTTPNotFound``) are no longer just import aliases for classes that |
|
1008 |
actually live in ``webob.exc``. Instead, we've defined our own exception |
|
1009 |
classes within the module that mirror and emulate the ``webob.exc`` |
1e5e31
|
1010 |
exception response objects almost entirely. See the "Design Defense" doc |
CM |
1011 |
section named "Pyramid Uses its Own HTTP Exception Classes" for more |
|
1012 |
information. |
53d11e
|
1013 |
|
d868ff
|
1014 |
Backwards Incompatibilities |
CM |
1015 |
--------------------------- |
99edc5
|
1016 |
|
5484e3
|
1017 |
- Pyramid no longer supports Python 2.4. Python 2.5 or better is required to |
CM |
1018 |
run Pyramid 1.1+. |
|
1019 |
|
99edc5
|
1020 |
- The Pyramid router now, by default, expects response objects returned from |
d868ff
|
1021 |
view callables to implement the ``pyramid.interfaces.IResponse`` interface. |
CM |
1022 |
Unlike the Pyramid 1.0 version of this interface, objects which implement |
|
1023 |
IResponse now must define a ``__call__`` method that accepts ``environ`` |
|
1024 |
and ``start_response``, and which returns an ``app_iter`` iterable, among |
|
1025 |
other things. Previously, it was possible to return any object which had |
|
1026 |
the three WebOb ``app_iter``, ``headerlist``, and ``status`` attributes as |
|
1027 |
a response, so this is a backwards incompatibility. It is possible to get |
|
1028 |
backwards compatibility back by registering an adapter to IResponse from |
|
1029 |
the type of object you're now returning from view callables. See the |
|
1030 |
section in the Hooks chapter of the documentation entitled "Changing How |
|
1031 |
Pyramid Treats View Responses". |
|
1032 |
|
|
1033 |
- The ``pyramid.interfaces.IResponse`` interface is now much more extensive. |
|
1034 |
Previously it defined only ``app_iter``, ``status`` and ``headerlist``; now |
|
1035 |
it is basically intended to directly mirror the ``webob.Response`` API, |
|
1036 |
which has many methods and attributes. |
966b5c
|
1037 |
|
d0a5f0
|
1038 |
- The ``pyramid.httpexceptions`` classes named ``HTTPFound``, |
CM |
1039 |
``HTTPMultipleChoices``, ``HTTPMovedPermanently``, ``HTTPSeeOther``, |
|
1040 |
``HTTPUseProxy``, and ``HTTPTemporaryRedirect`` now accept ``location`` as |
|
1041 |
their first positional argument rather than ``detail``. This means that |
|
1042 |
you can do, e.g. ``return pyramid.httpexceptions.HTTPFound('http://foo')`` |
|
1043 |
rather than ``return |
|
1044 |
pyramid.httpexceptions.HTTPFound(location='http//foo')`` (the latter will |
|
1045 |
of course continue to work). |
|
1046 |
|
0f7831
|
1047 |
Dependencies |
CM |
1048 |
------------ |
|
1049 |
|
dad904
|
1050 |
- Pyramid now depends on WebOb >= 1.0.2 as tests depend on the bugfix in that |
CM |
1051 |
release: "Fix handling of WSGI environs with missing ``SCRIPT_NAME``". |
0f7831
|
1052 |
(Note that in reality, everyone should probably be using 1.0.4 or better |
CM |
1053 |
though, as WebOb 1.0.2 and 1.0.3 were effectively brownbag releases.) |
|
1054 |
|