commit | author | age
|
b9c0e7
|
1 |
1.1a4 (2011-07-01) |
CM |
2 |
================== |
9395f0
|
3 |
|
CM |
4 |
Bug Fixes |
|
5 |
--------- |
|
6 |
|
|
7 |
- ``pyramid.testing.DummyRequest`` now raises deprecation warnings when |
|
8 |
attributes deprecated for ``pyramid.request.Request`` are accessed (like |
|
9 |
``response_content_type``). This is for the benefit of folks running unit |
|
10 |
tests which use DummyRequest instead of a "real" request, so they know |
|
11 |
things are deprecated without necessarily needing a functional test suite. |
|
12 |
|
2ea5c1
|
13 |
- The ``pyramid.events.subscriber`` directive behaved contrary to the |
CM |
14 |
documentation when passed more than one interface object to its |
|
15 |
constructor. For example, when the following listener was registered:: |
|
16 |
|
|
17 |
@subscriber(IFoo, IBar) |
|
18 |
def expects_ifoo_events_and_ibar_events(event): |
|
19 |
print event |
|
20 |
|
|
21 |
The Events chapter docs claimed that the listener would be registered and |
|
22 |
listening for both ``IFoo`` and ``IBar`` events. Instead, it registered an |
|
23 |
"object event" subscriber which would only be called if an IObjectEvent was |
|
24 |
emitted where the object interface was ``IFoo`` and the event interface was |
|
25 |
``IBar``. |
|
26 |
|
|
27 |
The behavior now matches the documentation. If you were relying on the |
|
28 |
buggy behavior of the 1.0 ``subscriber`` directive in order to register an |
|
29 |
object event subscriber, you must now pass a sequence to indicate you'd |
8519c9
|
30 |
like to register a subscriber for an object event. e.g.:: |
2ea5c1
|
31 |
|
CM |
32 |
@subscriber([IFoo, IBar]) |
|
33 |
def expects_object_event(object, event): |
|
34 |
print object, event |
|
35 |
|
c1f3d0
|
36 |
Features |
CM |
37 |
-------- |
|
38 |
|
|
39 |
- Add JSONP renderer (see "JSONP renderer" in the Renderers chapter of the |
|
40 |
documentation). |
|
41 |
|
b7f33b
|
42 |
Deprecations |
CM |
43 |
------------ |
|
44 |
|
|
45 |
- Deprecated the ``set_renderer_globals_factory`` method of the Configurator |
|
46 |
and the ``renderer_globals`` Configurator constructor parameter. |
|
47 |
|
05a1b4
|
48 |
Documentation |
CM |
49 |
------------- |
|
50 |
|
6c9959
|
51 |
- The Wiki and Wiki2 tutorial "Tests" chapters each had two bugs: neither did |
CM |
52 |
told the user to depend on WebTest, and 2 tests failed in each as the |
|
53 |
result of changes to Pyramid itself. These issues have been fixed. |
05a1b4
|
54 |
|
e21ed8
|
55 |
- Move 1.0.X CHANGES.txt entries to HISTORY.txt. |
CM |
56 |
|
1ba6fe
|
57 |
1.1a3 (2011-06-26) |
CM |
58 |
================== |
05fd08
|
59 |
|
8bd6cf
|
60 |
Features |
CM |
61 |
-------- |
|
62 |
|
|
63 |
- Added ``mako.preprocessor`` config file parameter; allows for a Mako |
|
64 |
preprocessor to be specified as a Python callable or Python dotted name. |
|
65 |
See https://github.com/Pylons/pyramid/pull/183 for rationale. |
|
66 |
|
05fd08
|
67 |
Bug fixes |
CM |
68 |
--------- |
|
69 |
|
|
70 |
- Pyramid would raise an AttributeError in the Configurator when attempting |
|
71 |
to set a ``__text__`` attribute on a custom predicate that was actually a |
|
72 |
classmethod. See https://github.com/Pylons/pyramid/pull/217 . |
|
73 |
|
d8c55c
|
74 |
- Accessing or setting deprecated response_* attrs on request |
CM |
75 |
(e.g. ``response_content_type``) now issues a deprecation warning at access |
|
76 |
time rather than at rendering time. |
05fd08
|
77 |
|
cc85e7
|
78 |
1.1a2 (2011-06-22) |
CM |
79 |
================== |
c724f0
|
80 |
|
d74d53
|
81 |
Bug Fixes |
CM |
82 |
--------- |
|
83 |
|
|
84 |
- 1.1a1 broke Akhet by not providing a backwards compatibility import shim |
|
85 |
for ``pyramid.paster.PyramidTemplate``. Now one has been added, although a |
cc85e7
|
86 |
deprecation warning is emitted when Akhet imports it. |
d74d53
|
87 |
|
6ed33e
|
88 |
- If multiple specs were provided in a single call to |
CM |
89 |
``config.add_translation_dirs``, the directories were inserted into the |
|
90 |
beginning of the directory list in the wrong order: they were inserted in |
|
91 |
the reverse of the order they were provided in the ``*specs`` list (items |
4f11dc
|
92 |
later in the list were added before ones earlier in the list). This is now |
CM |
93 |
fixed. |
6ed33e
|
94 |
|
c724f0
|
95 |
Backwards Incompatibilities |
CM |
96 |
--------------------------- |
|
97 |
|
|
98 |
- The pyramid Router attempted to set a value into the key |
|
99 |
``environ['repoze.bfg.message']`` when it caught a view-related exception |
cc85e7
|
100 |
for backwards compatibility with applications written for ``repoze.bfg`` |
CM |
101 |
during error handling. It did this by using code that looked like so:: |
c724f0
|
102 |
|
CM |
103 |
# "why" is an exception object |
|
104 |
try: |
|
105 |
msg = why[0] |
|
106 |
except: |
|
107 |
msg = '' |
|
108 |
|
|
109 |
environ['repoze.bfg.message'] = msg |
|
110 |
|
|
111 |
Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in |
|
112 |
Pyramid 1.0. Our standing policy is to not remove features after a |
|
113 |
deprecation for two full major releases, so this code was originally slated |
|
114 |
to be removed in Pyramid 1.2. However, computing the |
|
115 |
``repoze.bfg.message`` value was the source of at least one bug found in |
|
116 |
the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a |
|
117 |
foolproof way to both preserve backwards compatibility and to fix the bug. |
|
118 |
Therefore, the code which sets the value has been removed in this release. |
|
119 |
Code in exception views which relies on this value's presence in the |
|
120 |
environment should now use the ``exception`` attribute of the request |
|
121 |
(e.g. ``request.exception[0]``) to retrieve the message instead of relying |
|
122 |
on ``request.environ['repoze.bfg.message']``. |
|
123 |
|
83549e
|
124 |
1.1a1 (2011-06-20) |
CM |
125 |
================== |
959523
|
126 |
|
8027ad
|
127 |
Documentation |
JD |
128 |
------------- |
|
129 |
|
af71c2
|
130 |
- The term "template" used to refer to both "paster templates" and "rendered |
CM |
131 |
templates" (templates created by a rendering engine. i.e. Mako, Chameleon, |
|
132 |
Jinja, etc.). "Paster templates" will now be refered to as "scaffolds", |
|
133 |
whereas the name for "rendered templates" will remain as "templates." |
8027ad
|
134 |
|
88f967
|
135 |
- The ``wiki`` (ZODB+Traversal) tutorial was updated slightly. |
CM |
136 |
|
|
137 |
- The ``wiki2`` (SQLA+URL Dispatch) tutorial was updated slightly. |
|
138 |
|
d2973d
|
139 |
- Make ``pyramid.interfaces.IAuthenticationPolicy`` and |
CM |
140 |
``pyramid.interfaces.IAuthorizationPolicy`` public interfaces, and refer to |
|
141 |
them within the ``pyramid.authentication`` and ``pyramid.authorization`` |
|
142 |
API docs. |
|
143 |
|
|
144 |
- Render the function definitions for each exposed interface in |
|
145 |
``pyramid.interfaces``. |
|
146 |
|
cae85d
|
147 |
- Add missing docs reference to |
CM |
148 |
``pyramid.config.Configurator.set_view_mapper`` and refer to it within |
|
149 |
Hooks chapter section named "Using a View Mapper". |
|
150 |
|
f6799b
|
151 |
- Added section to the "Environment Variables and ``.ini`` File Settings" |
CM |
152 |
chapter in the narrative documentation section entitled "Adding a Custom |
|
153 |
Setting". |
|
154 |
|
2a1c3f
|
155 |
- Added documentation for a "multidict" (e.g. the API of ``request.POST``) as |
CM |
156 |
interface API documentation. |
|
157 |
|
e725cf
|
158 |
- Added a section to the "URL Dispatch" narrative chapter regarding the new |
CM |
159 |
"static" route feature. |
|
160 |
|
2ce652
|
161 |
- Added "What's New in Pyramid 1.1" to HTML rendering of documentation. |
CM |
162 |
|
0ca4bb
|
163 |
- Added API docs for ``pyramid.authentication.SessionAuthenticationPolicy``. |
CM |
164 |
|
f8f08b
|
165 |
- Added API docs for ``pyramid.httpexceptions.exception_response``. |
1ffb8e
|
166 |
|
CM |
167 |
- Added "HTTP Exceptions" section to Views narrative chapter including a |
f8f08b
|
168 |
description of ``pyramid.httpexceptions.exception_response``. |
1ffb8e
|
169 |
|
fcbd7b
|
170 |
Features |
CM |
171 |
-------- |
4d9260
|
172 |
|
f3e62c
|
173 |
- Add support for language fallbacks: when trying to translate for a |
WA |
174 |
specific territory (such as ``en_GB``) fall back to translations |
|
175 |
for the language (ie ``en``). This brings the translation behaviour in line |
|
176 |
with GNU gettext and fixes partially translated texts when using C |
|
177 |
extensions. |
|
178 |
|
0ca4bb
|
179 |
- New authentication policy: |
CM |
180 |
``pyramid.authentication.SessionAuthenticationPolicy``, which uses a session |
|
181 |
to store credentials. |
|
182 |
|
4d9260
|
183 |
- Accessing the ``response`` attribute of a ``pyramid.request.Request`` |
CM |
184 |
object (e.g. ``request.response`` within a view) now produces a new |
|
185 |
``pyramid.response.Response`` object. This feature is meant to be used |
|
186 |
mainly when a view configured with a renderer needs to set response |
db51c0
|
187 |
attributes: all renderers will use the Response object implied by |
CM |
188 |
``request.response`` as the response object returned to the router. |
|
189 |
|
|
190 |
``request.response`` can also be used by code in a view that does not use a |
|
191 |
renderer, however the response object that is produced by |
|
192 |
``request.response`` must be returned when a renderer is not in play (it is |
|
193 |
not a "global" response). |
fcbd7b
|
194 |
|
CM |
195 |
- Integers and longs passed as ``elements`` to ``pyramid.url.resource_url`` |
|
196 |
or ``pyramid.request.Request.resource_url`` e.g. ``resource_url(context, |
|
197 |
request, 1, 2)`` (``1`` and ``2`` are the ``elements``) will now be |
|
198 |
converted implicitly to strings in the result. Previously passing integers |
|
199 |
or longs as elements would cause a TypeError. |
|
200 |
|
296ee2
|
201 |
- ``pyramid_alchemy`` paster template now uses ``query.get`` rather than |
CM |
202 |
``query.filter_by`` to take better advantage of identity map caching. |
|
203 |
|
|
204 |
- ``pyramid_alchemy`` paster template now has unit tests. |
|
205 |
|
2242e6
|
206 |
- Added ``pyramid.i18n.make_localizer`` API (broken out from |
CM |
207 |
``get_localizer`` guts). |
|
208 |
|
ba2ac1
|
209 |
- An exception raised by a NewRequest event subscriber can now be caught by |
CM |
210 |
an exception view. |
|
211 |
|
b32552
|
212 |
- It is now possible to get information about why Pyramid raised a Forbidden |
CM |
213 |
exception from within an exception view. The ``ACLDenied`` object returned |
|
214 |
by the ``permits`` method of each stock authorization policy |
|
215 |
(``pyramid.interfaces.IAuthorizationPolicy.permits``) is now attached to |
|
216 |
the Forbidden exception as its ``result`` attribute. Therefore, if you've |
|
217 |
created a Forbidden exception view, you can see the ACE, ACL, permission, |
|
218 |
and principals involved in the request as |
|
219 |
eg. ``context.result.permission``, ``context.result.acl``, etc within the |
|
220 |
logic of the Forbidden exception view. |
|
221 |
|
474df5
|
222 |
- Don't explicitly prevent the ``timeout`` from being lower than the |
CM |
223 |
``reissue_time`` when setting up an ``AuthTktAuthenticationPolicy`` |
|
224 |
(previously such a configuration would raise a ``ValueError``, now it's |
|
225 |
allowed, although typically nonsensical). Allowing the nonsensical |
|
226 |
configuration made the code more understandable and required fewer tests. |
|
227 |
|
99a32e
|
228 |
- A new paster command named ``paster pviews`` was added. This command |
CM |
229 |
prints a summary of potentially matching views for a given path. See the |
|
230 |
section entitled "Displaying Matching Views for a Given URL" in the "View |
|
231 |
Configuration" chapter of the narrative documentation for more information. |
|
232 |
|
e725cf
|
233 |
- The ``add_route`` method of the Configurator now accepts a ``static`` |
CM |
234 |
argument. If this argument is ``True``, the added route will never be |
|
235 |
considered for matching when a request is handled. Instead, it will only |
|
236 |
be useful for URL generation via ``route_url`` and ``route_path``. See the |
|
237 |
section entitled "Static Routes" in the URL Dispatch narrative chapter for |
|
238 |
more information. |
|
239 |
|
966b5c
|
240 |
- A default exception view for the context |
99edc5
|
241 |
``pyramid.interfaces.IExceptionResponse`` is now registered by default. |
CM |
242 |
This means that an instance of any exception response class imported from |
|
243 |
``pyramid.httpexceptions`` (such as ``HTTPFound``) can now be raised from |
|
244 |
within view code; when raised, this exception view will render the |
|
245 |
exception to a response. |
1ffb8e
|
246 |
|
f8f08b
|
247 |
- A function named ``pyramid.httpexceptions.exception_response`` is a |
CM |
248 |
shortcut that can be used to create HTTP exception response objects using |
|
249 |
an HTTP integer status code. |
1ffb8e
|
250 |
|
CM |
251 |
- The Configurator now accepts an additional keyword argument named |
966b5c
|
252 |
``exceptionresponse_view``. By default, this argument is populated with a |
CM |
253 |
default exception view function that will be used when a response is raised |
|
254 |
as an exception. When ``None`` is passed for this value, an exception view |
|
255 |
for responses will not be registered. Passing ``None`` returns the |
|
256 |
behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception |
|
257 |
will propagate to middleware and to the WSGI server). |
|
258 |
|
|
259 |
- The ``pyramid.request.Request`` class now has a ``ResponseClass`` interface |
|
260 |
which points at ``pyramid.response.Response``. |
|
261 |
|
8cbbd9
|
262 |
- The ``pyramid.response.Response`` class now has a ``RequestClass`` |
CM |
263 |
interface which points at ``pyramid.request.Request``. |
1ffb8e
|
264 |
|
d868ff
|
265 |
- It is now possible to return an arbitrary object from a Pyramid view |
CM |
266 |
callable even if a renderer is not used, as long as a suitable adapter to |
|
267 |
``pyramid.interfaces.IResponse`` is registered for the type of the returned |
1a6fc7
|
268 |
object by using the new |
CM |
269 |
``pyramid.config.Configurator.add_response_adapter`` API. See the section |
|
270 |
in the Hooks chapter of the documentation entitled "Changing How Pyramid |
|
271 |
Treats View Responses". |
df15ed
|
272 |
|
99edc5
|
273 |
- The Pyramid router will now, by default, call the ``__call__`` method of |
CM |
274 |
WebOb response objects when returning a WSGI response. This means that, |
|
275 |
among other things, the ``conditional_response`` feature of WebOb response |
|
276 |
objects will now behave properly. |
df15ed
|
277 |
|
920990
|
278 |
- New method named ``pyramid.request.Request.is_response``. This method |
CM |
279 |
should be used instead of the ``pyramid.view.is_response`` function, which |
|
280 |
has been deprecated. |
e39ddf
|
281 |
|
JG |
282 |
Bug Fixes |
|
283 |
--------- |
|
284 |
|
0fd8ea
|
285 |
- URL pattern markers used in URL dispatch are permitted to specify a custom |
CM |
286 |
regex. For example, the pattern ``/{foo:\d+}`` means to match ``/12345`` |
|
287 |
(foo==12345 in the match dictionary) but not ``/abc``. However, custom |
0a0edf
|
288 |
regexes in a pattern marker which used squiggly brackets did not work. For |
CM |
289 |
example, ``/{foo:\d{4}}`` would fail to match ``/1234`` and |
|
290 |
``/{foo:\d{1,2}}`` would fail to match ``/1`` or ``/11``. One level of |
|
291 |
inner squiggly brackets is now recognized so that the prior two patterns |
|
292 |
given as examples now work. See also |
|
293 |
https://github.com/Pylons/pyramid/issues/#issue/123. |
|
294 |
|
|
295 |
- Don't send port numbers along with domain information in cookies set by |
115c71
|
296 |
AuthTktCookieHelper (see https://github.com/Pylons/pyramid/issues/131). |
CM |
297 |
|
|
298 |
- ``pyramid.url.route_path`` (and the shortcut |
|
299 |
``pyramid.request.Request.route_url`` method) now include the WSGI |
b596e1
|
300 |
SCRIPT_NAME at the front of the path if it is not empty (see |
CM |
301 |
https://github.com/Pylons/pyramid/issues/135). |
|
302 |
|
|
303 |
- ``pyramid.testing.DummyRequest`` now has a ``script_name`` attribute (the |
0b2629
|
304 |
empty string). |
CM |
305 |
|
|
306 |
- Don't quote ``:@&+$,`` symbols in ``*elements`` passed to |
|
307 |
``pyramid.url.route_url`` or ``pyramid.url.resource_url`` (see |
|
308 |
https://github.com/Pylons/pyramid/issues#issue/141). |
|
309 |
|
|
310 |
- Include SCRIPT_NAME in redirects issued by |
|
311 |
``pyramid.view.append_slash_notfound_view`` (see |
|
312 |
https://github.com/Pylons/pyramid/issues#issue/149). |
|
313 |
|
|
314 |
- Static views registered with ``config.add_static_view`` which also included |
|
315 |
a ``permission`` keyword argument would not work as expected, because |
|
316 |
``add_static_view`` also registered a route factory internally. Because a |
|
317 |
route factory was registered internally, the context checked by the Pyramid |
8af47b
|
318 |
permission machinery never had an ACL. ``add_static_view`` no longer |
CM |
319 |
registers a route with a factory, so the default root factory will be used. |
|
320 |
|
|
321 |
- ``config.add_static_view`` now passes extra keyword arguments it receives |
|
322 |
to ``config.add_route`` (calling add_static_view is mostly logically |
|
323 |
equivalent to adding a view of the type ``pyramid.static.static_view`` |
|
324 |
hooked up to a route with a subpath). This makes it possible to pass e.g., |
29a850
|
325 |
``factory=`` to ``add_static_view`` to protect a particular static view |
CM |
326 |
with a custom ACL. |
|
327 |
|
|
328 |
- ``testing.DummyRequest`` used the wrong registry (the global registry) as |
|
329 |
``self.registry`` if a dummy request was created *before* ``testing.setUp`` |
|
330 |
was executed (``testing.setUp`` pushes a local registry onto the |
|
331 |
threadlocal stack). Fixed by implementing ``registry`` as a property for |
|
332 |
DummyRequest instead of eagerly assigning an attribute. |
|
333 |
See also https://github.com/Pylons/pyramid/issues/165 |
|
334 |
|
ba0a5f
|
335 |
- When visiting a URL that represented a static view which resolved to a |
CM |
336 |
subdirectory, the ``index.html`` of that subdirectory would not be served |
|
337 |
properly. Instead, a redirect to ``/subdir`` would be issued. This has |
|
338 |
been fixed, and now visiting a subdirectory that contains an ``index.html`` |
|
339 |
within a static view returns the index.html properly. See also |
|
340 |
https://github.com/Pylons/pyramid/issues/67. |
|
341 |
|
4d9260
|
342 |
- Redirects issued by a static view did not take into account any existing |
CM |
343 |
``SCRIPT_NAME`` (such as one set by a url mapping composite). Now they do. |
|
344 |
|
|
345 |
- The ``pyramid.wsgi.wsgiapp2`` decorator did not take into account the |
|
346 |
``SCRIPT_NAME`` in the origin request. |
|
347 |
|
|
348 |
- The ``pyramid.wsgi.wsgiapp2`` decorator effectively only worked when it |
|
349 |
decorated a view found via traversal; it ignored the ``PATH_INFO`` that was |
|
350 |
part of a url-dispatch-matched view. |
|
351 |
|
|
352 |
Deprecations |
|
353 |
------------ |
|
354 |
|
|
355 |
- Deprecated all assignments to ``request.response_*`` attributes (for |
|
356 |
example ``request.response_content_type = 'foo'`` is now deprecated). |
ed7ffe
|
357 |
Assignments and mutations of assignable request attributes that were |
CM |
358 |
considered by the framework for response influence are now deprecated: |
|
359 |
``response_content_type``, ``response_headerlist``, ``response_status``, |
|
360 |
``response_charset``, and ``response_cache_for``. Instead of assigning |
|
361 |
these to the request object for later detection by the rendering machinery, |
|
362 |
users should use the appropriate API of the Response object created by |
|
363 |
accessing ``request.response`` (e.g. code which does |
|
364 |
``request.response_content_type = 'abc'`` should be changed to |
|
365 |
``request.response.content_type = 'abc'``). |
|
366 |
|
|
367 |
- Passing view-related parameters to |
|
368 |
``pyramid.config.Configurator.add_route`` is now deprecated. Previously, a |
|
369 |
view was permitted to be connected to a route using a set of ``view*`` |
|
370 |
parameters passed to the ``add_route`` method of the Configurator. This |
|
371 |
was a shorthand which replaced the need to perform a subsequent call to |
|
372 |
``add_view``. For example, it was valid (and often recommended) to do:: |
|
373 |
|
|
374 |
config.add_route('home', '/', view='mypackage.views.myview', |
|
375 |
view_renderer='some/renderer.pt') |
|
376 |
|
bf8c8f
|
377 |
Passing ``view*`` arguments to ``add_route`` is now deprecated in favor of |
CM |
378 |
connecting a view to a predefined route via ``Configurator.add_view`` using |
|
379 |
the route's ``route_name`` parameter. As a result, the above example |
ed7ffe
|
380 |
should now be spelled:: |
CM |
381 |
|
f426e5
|
382 |
config.add_route('home', '/') |
CM |
383 |
config.add_view('mypackage.views.myview', route_name='home') |
|
384 |
renderer='some/renderer.pt') |
|
385 |
|
|
386 |
This deprecation was done to reduce confusion observed in IRC, as well as |
|
387 |
to (eventually) reduce documentation burden (see also |
|
388 |
https://github.com/Pylons/pyramid/issues/164). A deprecation warning is |
|
389 |
now issued when any view-related parameter is passed to |
|
390 |
``Configurator.add_route``. |
|
391 |
|
|
392 |
- Passing an ``environ`` dictionary to the ``__call__`` method of a |
|
393 |
"traverser" (e.g. an object that implements |
|
394 |
``pyramid.interfaces.ITraverser`` such as an instance of |
|
395 |
``pyramid.traversal.ResourceTreeTraverser``) as its ``request`` argument |
|
396 |
now causes a deprecation warning to be emitted. Consumer code should pass a |
|
397 |
``request`` object instead. The fact that passing an environ dict is |
|
398 |
permitted has been documentation-deprecated since ``repoze.bfg`` 1.1, and |
|
399 |
this capability will be removed entirely in a future version. |
|
400 |
|
|
401 |
- The following (undocumented, dictionary-like) methods of the |
4d9260
|
402 |
``pyramid.request.Request`` object have been deprecated: ``__contains__``, |
CM |
403 |
``__delitem__``, ``__getitem__``, ``__iter__``, ``__setitem__``, ``get``, |
|
404 |
``has_key``, ``items``, ``iteritems``, ``itervalues``, ``keys``, ``pop``, |
|
405 |
``popitem``, ``setdefault``, ``update``, and ``values``. Usage of any of |
|
406 |
these methods will cause a deprecation warning to be emitted. These |
|
407 |
methods were added for internal compatibility in ``repoze.bfg`` 1.1 (code |
|
408 |
that currently expects a request object expected an environ object in BFG |
|
409 |
1.0 and before). In a future version, these methods will be removed |
|
410 |
entirely. |
|
411 |
|
920990
|
412 |
- Deprecated ``pyramid.view.is_response`` function in favor of (newly-added) |
CM |
413 |
``pyramid.request.Request.is_response`` method. Determining if an object |
|
414 |
is truly a valid response object now requires access to the registry, which |
|
415 |
is only easily available as a request attribute. The |
|
416 |
``pyramid.view.is_response`` function will still work until it is removed, |
|
417 |
but now may return an incorrect answer under some (very uncommon) |
|
418 |
circumstances. |
|
419 |
|
4d9260
|
420 |
Behavior Changes |
CM |
421 |
---------------- |
|
422 |
|
18b25a
|
423 |
- The default Mako renderer is now configured to escape all HTML in |
MM |
424 |
expression tags. This is intended to help prevent XSS attacks caused by |
|
425 |
rendering unsanitized input from users. To revert this behavior in user's |
|
426 |
templates, they need to filter the expression through the 'n' filter. |
|
427 |
For example, ${ myhtml | n }. |
|
428 |
See https://github.com/Pylons/pyramid/issues/193. |
|
429 |
|
99edc5
|
430 |
- A custom request factory is now required to return a request object that |
4d9260
|
431 |
has a ``response`` attribute (or "reified"/lazy property) if they the |
CM |
432 |
request is meant to be used in a view that uses a renderer. This |
|
433 |
``response`` attribute should be an instance of the class |
|
434 |
``pyramid.response.Response``. |
|
435 |
|
|
436 |
- The JSON and string renderer factories now assign to |
|
437 |
``request.response.content_type`` rather than |
bf7544
|
438 |
``request.response_content_type``. |
CM |
439 |
|
|
440 |
- Each built-in renderer factory now determines whether it should change the |
|
441 |
content type of the response by comparing the response's content type |
|
442 |
against the response's default content type; if the content type is the |
|
443 |
default content type (usually ``text/html``), the renderer changes the |
|
444 |
content type (to ``application/json`` or ``text/plain`` for JSON and string |
|
445 |
renderers respectively). |
4d9260
|
446 |
|
ba0a5f
|
447 |
- The ``pyramid.wsgi.wsgiapp2`` now uses a slightly different method of |
CM |
448 |
figuring out how to "fix" ``SCRIPT_NAME`` and ``PATH_INFO`` for the |
|
449 |
downstream application. As a result, those values may differ slightly from |
|
450 |
the perspective of the downstream application (for example, ``SCRIPT_NAME`` |
|
451 |
will now never possess a trailing slash). |
|
452 |
|
bca03f
|
453 |
- Previously, ``pyramid.request.Request`` inherited from |
CM |
454 |
``webob.request.Request`` and implemented ``__getattr__``, ``__setattr__`` |
|
455 |
and ``__delattr__`` itself in order to overidde "adhoc attr" WebOb behavior |
|
456 |
where attributes of the request are stored in the environ. Now, |
|
457 |
``pyramid.request.Request`` object inherits from (the more recent) |
|
458 |
``webob.request.BaseRequest`` instead of ``webob.request.Request``, which |
|
459 |
provides the same behavior. ``pyramid.request.Request`` no longer |
|
460 |
implements its own ``__getattr__``, ``__setattr__`` or ``__delattr__`` as a |
|
461 |
result. |
|
462 |
|
966b5c
|
463 |
- ``pyramid.response.Response`` is now a *subclass* of |
99edc5
|
464 |
``webob.response.Response`` (in order to directly implement the |
CM |
465 |
``pyramid.interfaces.IResponse`` interface). |
|
466 |
|
53d11e
|
467 |
- The "exception response" objects importable from ``pyramid.httpexceptions`` |
CM |
468 |
(e.g. ``HTTPNotFound``) are no longer just import aliases for classes that |
|
469 |
actually live in ``webob.exc``. Instead, we've defined our own exception |
|
470 |
classes within the module that mirror and emulate the ``webob.exc`` |
1e5e31
|
471 |
exception response objects almost entirely. See the "Design Defense" doc |
CM |
472 |
section named "Pyramid Uses its Own HTTP Exception Classes" for more |
|
473 |
information. |
53d11e
|
474 |
|
d868ff
|
475 |
Backwards Incompatibilities |
CM |
476 |
--------------------------- |
99edc5
|
477 |
|
5484e3
|
478 |
- Pyramid no longer supports Python 2.4. Python 2.5 or better is required to |
CM |
479 |
run Pyramid 1.1+. |
|
480 |
|
99edc5
|
481 |
- The Pyramid router now, by default, expects response objects returned from |
d868ff
|
482 |
view callables to implement the ``pyramid.interfaces.IResponse`` interface. |
CM |
483 |
Unlike the Pyramid 1.0 version of this interface, objects which implement |
|
484 |
IResponse now must define a ``__call__`` method that accepts ``environ`` |
|
485 |
and ``start_response``, and which returns an ``app_iter`` iterable, among |
|
486 |
other things. Previously, it was possible to return any object which had |
|
487 |
the three WebOb ``app_iter``, ``headerlist``, and ``status`` attributes as |
|
488 |
a response, so this is a backwards incompatibility. It is possible to get |
|
489 |
backwards compatibility back by registering an adapter to IResponse from |
|
490 |
the type of object you're now returning from view callables. See the |
|
491 |
section in the Hooks chapter of the documentation entitled "Changing How |
|
492 |
Pyramid Treats View Responses". |
|
493 |
|
|
494 |
- The ``pyramid.interfaces.IResponse`` interface is now much more extensive. |
|
495 |
Previously it defined only ``app_iter``, ``status`` and ``headerlist``; now |
|
496 |
it is basically intended to directly mirror the ``webob.Response`` API, |
|
497 |
which has many methods and attributes. |
966b5c
|
498 |
|
d0a5f0
|
499 |
- The ``pyramid.httpexceptions`` classes named ``HTTPFound``, |
CM |
500 |
``HTTPMultipleChoices``, ``HTTPMovedPermanently``, ``HTTPSeeOther``, |
|
501 |
``HTTPUseProxy``, and ``HTTPTemporaryRedirect`` now accept ``location`` as |
|
502 |
their first positional argument rather than ``detail``. This means that |
|
503 |
you can do, e.g. ``return pyramid.httpexceptions.HTTPFound('http://foo')`` |
|
504 |
rather than ``return |
|
505 |
pyramid.httpexceptions.HTTPFound(location='http//foo')`` (the latter will |
|
506 |
of course continue to work). |
|
507 |
|
0f7831
|
508 |
Dependencies |
CM |
509 |
------------ |
|
510 |
|
dad904
|
511 |
- Pyramid now depends on WebOb >= 1.0.2 as tests depend on the bugfix in that |
CM |
512 |
release: "Fix handling of WSGI environs with missing ``SCRIPT_NAME``". |
0f7831
|
513 |
(Note that in reality, everyone should probably be using 1.0.4 or better |
CM |
514 |
though, as WebOb 1.0.2 and 1.0.3 were effectively brownbag releases.) |
|
515 |
|