Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 706 lines (540 sloc) 30.891 kb
2d93140 @mmerickel support acl as a callable
mmerickel authored
1 next release
2 ============
3
4 Features
5 --------
6
7 - ``ACLAuthorizationPolicy`` supports ``__acl__`` as a callable. This
8 removes the ambiguity between the potential ``AttributeError`` that would
9 be raised on the ``context`` when the property was not defined and the
10 ``AttributeError`` that could be raised from any user-defined code within
11 a dynamic property. It is recommended to define a dynamic ACL as a callable
12 to avoid this ambiguity. See https://github.com/Pylons/pyramid/issues/735.
13
ff41f86 @wosc Fixes #798: Allow a protocol-relative URL to be passed to add_static_…
wosc authored
14 - Allow a protocol-relative URL (e.g. ``//example.com/images``) to be passed to
15 ``pyramid.config.Configurator.add_static_view``. This allows
16 externally-hosted static URLs to be generated based on the current protocol.
17
18
96ab9f2 @mcdonc prep for 1.4
mcdonc authored
19 1.4 (2012-12-18)
20 ================
758fa23 @mcdonc garden
mcdonc authored
21
22 Docs
23 ----
24
25 - Fix functional tests in the ZODB tutorial
26
e609e19 @mcdonc prep for 1.4b3
mcdonc authored
27 1.4b3 (2012-12-10)
28 ==================
29
30 - Packaging release only, no code changes. 1.4b2 was a brownbag release due to
31 missing directories in the tarball.
32
a7e0e60 @mcdonc prep for 1.4b2
mcdonc authored
33 1.4b2 (2012-12-10)
34 ==================
35
36 Docs
37 ----
38
39 - Scaffolding is now PEP-8 compliant (at least for a brief shining moment).
40
41 - Tutorial improvements.
ed14191 @mmerickel _depth argument to view_config is now relative to view_config
mmerickel authored
42
43 Backwards Incompatibilities
44 ---------------------------
45
46 - Modified the ``_depth`` argument to ``pyramid.view.view_config`` to accept
47 a value relative to the invocation of ``view_config`` itself. Thus, when it
48 was previously expecting a value of ``1`` or greater, to reflect that
49 the caller of ``view_config`` is 1 stack frame away from ``venusian.attach``,
50 this implementation detail is now hidden.
51
a078e19 @mcdonc add changenote
mcdonc authored
52 - Modified the ``_backframes`` argument to ``pyramid.util.action_method`` in a
53 similar way to the changes described to ``_depth`` above. This argument
54 remains undocumented, but might be used in the wild by some insane person.
55
1608b26 @mcdonc prep for 1.4b1
mcdonc authored
56 1.4b1 (2012-11-21)
57 ==================
0ccdc23 @mcdonc - A failure when trying to locate the attribute ``__text__`` on route…
mcdonc authored
58
71cd93b @mcdonc - Small microspeed enhancement which anticipates that a
mcdonc authored
59 Features
60 --------
61
62 - Small microspeed enhancement which anticipates that a
63 ``pyramid.response.Response`` object is likely to be returned from a view.
64 Some code is shortcut if the class of the object returned by a view is this
65 class. A similar microoptimization was done to
66 ``pyramid.request.Request.is_response``.
67
9132f65 @mcdonc garden
mcdonc authored
68 - Make it possible to use variable arguments on ``p*`` commands (``pserve``,
69 ``pshell``, ``pviews``, etc) in the form ``a=1 b=2`` so you can fill in
70 values in parameterized ``.ini`` file, e.g. ``pshell etc/development.ini
6ba0fc7 @mcdonc garden
mcdonc authored
71 http_port=8080``. See https://github.com/Pylons/pyramid/pull/714
9132f65 @mcdonc garden
mcdonc authored
72
f700d37 @mcdonc garden
mcdonc authored
73 - A somewhat advanced and obscure feature of Pyramid event handlers is their
74 ability to handle "multi-interface" notifications. These notifications have
75 traditionally presented multiple objects to the subscriber callable. For
76 instance, if an event was sent by code like this::
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
77
78 registry.notify(event, context)
79
80 In the past, in order to catch such an event, you were obligated to write and
81 register an event subscriber that mentioned both the event and the context in
82 its argument list::
83
84 @subscriber([SomeEvent, SomeContextType])
f700d37 @mcdonc garden
mcdonc authored
85 def asubscriber(event, context):
86 pass
87
88 In many subscriber callables registered this way, it was common for the logic
89 in the subscriber callable to completely ignore the second and following
90 arguments (e.g. ``context`` in the above example might be ignored), because
91 they usually existed as attributes of the event anyway. You could usually
a3810e7 @mcdonc garden
mcdonc authored
92 get the same value by doing ``event.context`` or similar.
f700d37 @mcdonc garden
mcdonc authored
93
94 The fact that you needed to put an extra argument which you usually ignored
95 in the subscriber callable body was only a minor annoyance until we added
a3810e7 @mcdonc garden
mcdonc authored
96 "subscriber predicates", used to narrow the set of circumstances under which
97 a subscriber will be executed, in a prior 1.4 alpha release. Once those were
98 added, the annoyance was escalated, because subscriber predicates needed to
99 accept the same argument list and arity as the subscriber callables that they
100 were configured against. So, for example, if you had these two subscriber
101 registrations in your code::
f700d37 @mcdonc garden
mcdonc authored
102
103 @subscriber([SomeEvent, SomeContextType])
104 def asubscriber(event, context):
105 pass
106
107 @subscriber(SomeOtherEvent)
108 def asubscriber(event):
109 pass
110
111 And you wanted to use a subscriber predicate::
112
113 @subscriber([SomeEvent, SomeContextType], mypredicate=True)
a3810e7 @mcdonc garden
mcdonc authored
114 def asubscriber1(event, context):
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
115 pass
116
f700d37 @mcdonc garden
mcdonc authored
117 @subscriber(SomeOtherEvent, mypredicate=True)
a3810e7 @mcdonc garden
mcdonc authored
118 def asubscriber2(event):
f700d37 @mcdonc garden
mcdonc authored
119 pass
120
a3810e7 @mcdonc garden
mcdonc authored
121 If an existing ``mypredicate`` subscriber predicate had been written in such
122 a way that it accepted only one argument in its ``__call__``, you could not
123 use it against a subscription which named more than one interface in its
124 subscriber interface list. Similarly, if you had written a subscriber
125 predicate that accepted two arguments, you couldn't use it against a
126 registration that named only a single interface type.
127
128 For example, if you created this predicate::
f700d37 @mcdonc garden
mcdonc authored
129
130 class MyPredicate(object):
131 # portions elided...
132 def __call__(self, event):
133 return self.val == event.context.foo
134
a3810e7 @mcdonc garden
mcdonc authored
135 It would not work against a multi-interface-registered subscription, so in
136 the above example, when you attempted to use it against ``asubscriber1``, it
137 would fail at runtime with a TypeError, claiming something was attempting to
138 call it with too many arguments.
f700d37 @mcdonc garden
mcdonc authored
139
a3810e7 @mcdonc garden
mcdonc authored
140 To hack around this limitation, you were obligated to design the
141 ``mypredicate`` predicate to expect to receive in its ``__call__`` either a
142 single ``event`` argument (a SomeOtherEvent object) *or* a pair of arguments
143 (a SomeEvent object and a SomeContextType object), presumably by doing
144 something like this::
f700d37 @mcdonc garden
mcdonc authored
145
146 class MyPredicate(object):
147 # portions elided...
148 def __call__(self, event, context=None):
149 return self.val == event.context.foo
150
151 This was confusing and bad.
152
153 In order to allow people to ignore unused arguments to subscriber callables
154 and to normalize the relationship between event subscribers and subscriber
155 predicates, we now allow both subscribers and subscriber predicates to accept
156 only a single ``event`` argument even if they've been subscribed for
157 notifications that involve multiple interfaces. Subscribers and subscriber
158 predicates that accept only one argument will receive the first object passed
159 to ``notify``; this is typically (but not always) the event object. The
160 other objects involved in the subscription lookup will be discarded. You can
161 now write an event subscriber that accepts only ``event`` even if it
162 subscribes to multiple interfaces::
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
163
164 @subscriber([SomeEvent, SomeContextType])
f700d37 @mcdonc garden
mcdonc authored
165 def asubscriber(event):
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
166 # this will work!
167
f700d37 @mcdonc garden
mcdonc authored
168 This prevents you from needing to match the subscriber callable parameters to
169 the subscription type unnecessarily, especially when you don't make use of
170 any argument in your subscribers except for the event object itself.
171
172 Note, however, that if the event object is not the first
173 object in the call to ``notify``, you'll run into trouble. For example, if
174 notify is called with the context argument first::
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
175
176 registry.notify(context, event)
177
f700d37 @mcdonc garden
mcdonc authored
178 You won't be able to take advantage of the event-only feature. It will
179 "work", but the object received by your event handler won't be the event
180 object, it will be the context object, which won't be very useful::
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
181
182 @subscriber([SomeContextType, SomeEvent])
f700d37 @mcdonc garden
mcdonc authored
183 def asubscriber(event):
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
184 # bzzt! you'll be getting the context here as ``event``, and it'll
185 # be useless
186
187 Existing multiple-argument subscribers continue to work without issue, so you
188 should continue use those if your system notifies using multiple interfaces
189 and the first interface is not the event interface. For example::
190
191 @subscriber([SomeContextType, SomeEvent])
f700d37 @mcdonc garden
mcdonc authored
192 def asubscriber(context, event):
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
193 # this will still work!
194
195 The event-only feature makes it possible to use a subscriber predicate that
196 accepts only a request argument within both multiple-interface subscriber
f700d37 @mcdonc garden
mcdonc authored
197 registrations and single-interface subscriber registrations. You needn't
198 make slightly different variations of predicates depending on the
199 subscription type arguments. Instead, just write all your subscriber
200 predicates so they only accept ``event`` in their ``__call__`` and they'll be
201 useful across all registrations for subscriptions that use an event as their
202 first argument, even ones which accept more than just ``event``.
203
204 However, the same caveat applies to predicates as to subscriber callables: if
205 you're subscribing to a multi-interface event, and the first interface is not
206 the event interface, the predicate won't work properly. In such a case,
207 you'll need to match the predicate ``__call__`` argument ordering and
208 composition to the ordering of the interfaces. For example, if the
209 registration for the subscription uses ``[SomeContext, SomeEvent]``, you'll
210 need to reflect that in the ordering of the parameters of the predicate's
211 ``__call__`` method::
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
212
213 def __call__(self, context, event):
214 return event.request.path.startswith(self.val)
215
f700d37 @mcdonc garden
mcdonc authored
216 tl;dr: 1) When using multi-interface subscriptions, always use the event type
217 as the first subscription registration argument and 2) When 1 is true, use
218 only ``event`` in your subscriber and subscriber predicate parameter lists,
219 no matter how many interfaces the subscriber is notified with. This
220 combination will result in the maximum amount of reusability of subscriber
221 predicates and the least amount of thought on your part. Drink responsibly.
28fc3d5 @mcdonc - In order to normalize the relationship between event subscribers and
mcdonc authored
222
0ccdc23 @mcdonc - A failure when trying to locate the attribute ``__text__`` on route…
mcdonc authored
223 Bug Fixes
224 ---------
225
226 - A failure when trying to locate the attribute ``__text__`` on route and view
227 predicates existed when the ``debug_routematch`` setting was true or when the
228 ``pviews`` command was used. See https://github.com/Pylons/pyramid/pull/727
229
b5e4443 @mcdonc garden
mcdonc authored
230 Documentation
231 -------------
232
233 - Sync up tutorial source files with the files that are rendered by the
234 scaffold that each uses.
235
9480686 @mcdonc prep for release
mcdonc authored
236 1.4a4 (2012-11-14)
237 ==================
c7337ba @mcdonc - Added an ``effective_principals`` route and view predicate.
mcdonc authored
238
239 Features
240 --------
241
19b8207 @mmerickel merged SHA512AuthTktAuthenticationPolicy into AuthTktAuthenticationPo…
mmerickel authored
242 - ``pyramid.authentication.AuthTktAuthenticationPolicy`` has been updated to
243 support newer hashing algorithms such as ``sha512``. Existing applications
39ef68d @mcdonc rearrange deck chairs
mcdonc authored
244 should consider updating if possible for improved security over the default
245 md5 hashing.
19b8207 @mmerickel merged SHA512AuthTktAuthenticationPolicy into AuthTktAuthenticationPo…
mmerickel authored
246
c7337ba @mcdonc - Added an ``effective_principals`` route and view predicate.
mcdonc authored
247 - Added an ``effective_principals`` route and view predicate.
248
07c9ee0 @mcdonc - Do not allow the userid returned from the ``authenticated_userid`` …
mcdonc authored
249 - Do not allow the userid returned from the ``authenticated_userid`` or the
250 userid that is one of the list of principals returned by
251 ``effective_principals`` to be either of the strings ``system.Everyone`` or
252 ``system.Authenticated`` when any of the built-in authorization policies that
253 live in ``pyramid.authentication`` are in use. These two strings are
254 reserved for internal usage by Pyramid and they will not be accepted as valid
255 userids.
256
ca46568 @mmerickel garden
mmerickel authored
257 - Slightly better debug logging from
258 ``pyramid.authentication.RepozeWho1AuthenticationPolicy``.
47146eb @mcdonc garden
mcdonc authored
259
39ef68d @mcdonc rearrange deck chairs
mcdonc authored
260 - ``pyramid.security.view_execution_permitted`` used to return ``True`` if no
926fb68 @mcdonc resolve merge conflict
mcdonc authored
261 view could be found. It now raises a ``TypeError`` exception in that case, as
262 it doesn't make sense to assert that a nonexistent view is
263 execution-permitted. See https://github.com/Pylons/pyramid/issues/299.
6099144 @mmerickel updated changes
mmerickel authored
264
a8d71ca @mcdonc - Allow a ``_depth`` argument to ``pyramid.view.view_config``, which …
mcdonc authored
265 - Allow a ``_depth`` argument to ``pyramid.view.view_config``, which will
266 permit limited composition reuse of the decorator by other software that
267 wants to provide custom decorators that are much like view_config.
268
1701243 @mmerickel update changelog, close #627
mmerickel authored
269 - Allow an iterable of decorators to be passed to
270 ``pyramid.config.Configurator.add_view``. This allows views to be wrapped
271 by more than one decorator without requiring combining the decorators
272 yourself.
273
a007a4f @mcdonc - In the past if a renderer returned ``None``, the body of the resulting
mcdonc authored
274 Bug Fixes
275 ---------
276
277 - In the past if a renderer returned ``None``, the body of the resulting
278 response would be set explicitly to the empty string. Instead, now, the body
279 is left unchanged, which allows the renderer to set a body itself by using
280 e.g. ``request.response.body = b'foo'``. The body set by the renderer will
281 be unmolested on the way out. See
282 https://github.com/Pylons/pyramid/issues/709
283
34d4cd0 @mcdonc - In uncommon cases, the ``pyramid_excview_tween_factory`` might have
mcdonc authored
284 - In uncommon cases, the ``pyramid_excview_tween_factory`` might have
285 inadvertently raised a ``KeyError`` looking for ``request_iface`` as an
286 attribute of the request. It no longer fails in this case. See
287 https://github.com/Pylons/pyramid/issues/700
288
267dbd2 @mcdonc - Be more tolerant of potential error conditions in ``match_param`` and
mcdonc authored
289 - Be more tolerant of potential error conditions in ``match_param`` and
290 ``physical_path`` predicate implementations; instead of raising an exception,
291 return False.
292
39ef68d @mcdonc rearrange deck chairs
mcdonc authored
293 - ``pyramid.view.render_view`` was not functioning properly under Python 3.x
294 due to a byte/unicode discrepancy. See
cd8ac80 @tshepang update some links and fix others
tshepang authored
295 https://github.com/Pylons/pyramid/issues/721
f89cfcd @mmerickel updated changelog
mmerickel authored
296
ca3df80 @mmerickel emit a warning if a user is using the default hashalg to AuthTkt
mmerickel authored
297 Deprecations
298 ------------
299
39ef68d @mcdonc rearrange deck chairs
mcdonc authored
300 - ``pyramid.authentication.AuthTktAuthenticationPolicy`` will emit a warning if
301 an application is using the policy without explicitly passing a ``hashalg``
302 argument. This is because the default is "md5" which is considered
303 theoretically subject to collision attacks. If you really want "md5" then you
304 must specify it explicitly to get rid of the warning.
305
306 Documentation
307 -------------
308
309 - All of the tutorials that use
310 ``pyramid.authentication.AuthTktAuthenticationPolicy`` now explicitly pass
311 ``sha512`` as a ``hashalg`` argument.
312
ca3df80 @mmerickel emit a warning if a user is using the default hashalg to AuthTkt
mmerickel authored
313
66fe1d0 @mcdonc - Move ``TopologicalSorter`` from ``pyramid.config.util`` to ``pyrami…
mcdonc authored
314 Internals
315 ---------
316
317 - Move ``TopologicalSorter`` from ``pyramid.config.util`` to ``pyramid.util``,
318 move ``CyclicDependencyError`` from ``pyramid.config.util`` to
319 ``pyramid.exceptions``, rename ``Singleton`` to ``Sentinel`` and move from
ca46568 @mmerickel garden
mmerickel authored
320 ``pyramid.config.util`` to ``pyramid.util``; this is in an effort to
0487545 @mcdonc fix docs, upgrade tutorials, add change note, deprecate using zope.de…
mcdonc authored
321 move that stuff that may be an API one day out of ``pyramid.config.util``,
66fe1d0 @mcdonc - Move ``TopologicalSorter`` from ``pyramid.config.util`` to ``pyrami…
mcdonc authored
322 because that package should never be imported from non-Pyramid code.
323 TopologicalSorter is still not an API, but may become one.
324
39ef68d @mcdonc rearrange deck chairs
mcdonc authored
325 - Get rid of shady monkeypatching of ``pyramid.request.Request`` and
326 ``pyramid.response.Response`` done within the ``__init__.py`` of Pyramid.
327 Webob no longer relies on this being done. Instead, the ResponseClass
328 attribute of the Pyramid Request class is assigned to the Pyramid response
329 class; that's enough to satisfy WebOb and behave as it did before with the
330 monkeypatching.
331
4a6cca6 @mcdonc prep for 1.4a3
mcdonc authored
332 1.4a3 (2012-10-26)
333 ==================
d6fb001 @mcdonc - 1.4a ``pyramid.scripting.prepare`` behaved differently than 1.3 series
mcdonc authored
334
335 Bug Fixes
336 ---------
337
06a904f @mcdonc add docs and changelog note
mcdonc authored
338 - The match_param predicate's text method was fixed to sort its values.
339 Part of https://github.com/Pylons/pyramid/pull/705
340
d6fb001 @mcdonc - 1.4a ``pyramid.scripting.prepare`` behaved differently than 1.3 series
mcdonc authored
341 - 1.4a ``pyramid.scripting.prepare`` behaved differently than 1.3 series
342 function of same name. In particular, if passed a request, it would not
343 set the ``registry`` attribute of the request like 1.3 did. A symptom
344 would be that passing a request to ``pyramid.paster.bootstrap`` (which uses
345 the function) that did not have a ``registry`` attribute could assume that
346 the registry would be attached to the request by Pyramid. This assumption
347 could be made in 1.3, but not in 1.4. The assumption can now be made in
348 1.4 too (a registry is attached to a request passed to bootstrap or
349 prepare).
350
66d277a @mcdonc garden
mcdonc authored
351 - When registering a view configuration that named a Chameleon ZPT renderer
352 with a macro name in it (e.g. ``renderer='some/template#somemacro.pt``) as
043ccdd @tshepang eliminate other repeated words
tshepang authored
353 well as a view configuration without a macro name in it that pointed to the
9937a4e @chrisrossi Fix rst syntax error which prevented Sphinx docs from building.
chrisrossi authored
354 same template (e.g. ``renderer='some/template.pt'``), internal caching could
66d277a @mcdonc garden
mcdonc authored
355 confuse the two, and your code might have rendered one instead of the
356 other.
357
1273d56 @mcdonc - The Configurator ``testing_securitypolicy`` method now returns the …
mcdonc authored
358 Features
359 --------
360
c25a8fd @mcdonc - New ``physical_path`` view predicate. If specified, this value sho…
mcdonc authored
361 - Allow multiple values to be specified to the ``request_param`` view/route
362 predicate as a sequence. Previously only a single string value was allowed.
363 See https://github.com/Pylons/pyramid/pull/705
364
365 - Comments with references to documentation sections placed in scaffold
366 ``.ini`` files.
367
368 - Added an HTTP Basic authentication policy
369 at ``pyramid.authentication.BasicAuthAuthenticationPolicy``.
370
1273d56 @mcdonc - The Configurator ``testing_securitypolicy`` method now returns the …
mcdonc authored
371 - The Configurator ``testing_securitypolicy`` method now returns the policy
372 object it creates.
373
374 - The Configurator ``testing_securitypolicy`` method accepts two new
375 arguments: ``remember_result`` and ``forget_result``. If supplied, these
376 values influence the result of the policy's ``remember`` and ``forget``
377 methods, respectively.
378
379 - The DummySecurityPolicy created by ``testing_securitypolicy`` now sets a
380 ``forgotten`` value on the policy (the value ``True``) when its ``forget``
381 method is called.
382
383 - The DummySecurityPolicy created by ``testing_securitypolicy`` now sets a
384 ``remembered`` value on the policy, which is the value of the ``principal``
385 argument it's called with when its ``remember`` method is called.
386
c25a8fd @mcdonc - New ``physical_path`` view predicate. If specified, this value sho…
mcdonc authored
387 - New ``physical_path`` view predicate. If specified, this value should be a
388 string or a tuple representing the physical traversal path of the context
389 found via traversal for this predicate to match as true. For example:
390 ``physical_path='/'`` or ``physical_path='/a/b/c'`` or ``physical_path=('',
391 'a', 'b', 'c')``. This is not a path prefix match or a regex, it's a
392 whole-path match. It's useful when you want to always potentially show a
393 view when some object is traversed to, but you can't be sure about what kind
394 of object it will be, so you can't use the ``context`` predicate. The
395 individual path elements inbetween slash characters or in tuple elements
396 should be the Unicode representation of the name of the resource and should
397 not be encoded in any way.
398
072cbf7 @mcdonc prep for 1.4a2
mcdonc authored
399 1.4a2 (2012-09-27)
400 ==================
68c25d3 @mcdonc garden
mcdonc authored
401
d27bc79 @mcdonc garden
mcdonc authored
402 Bug Fixes
403 ---------
404
4388d31 @mcdonc mirror john's change for chameleon, better changelog message
mcdonc authored
405 - When trying to determine Mako defnames and Chameleon macro names in asset
406 specifications, take into account that the filename may have a hyphen in
407 it. See https://github.com/Pylons/pyramid/pull/692
d27bc79 @mcdonc garden
mcdonc authored
408
68c25d3 @mcdonc garden
mcdonc authored
409 Features
410 --------
411
412 - A new ``pyramid.session.check_csrf_token`` convenience function was added.
413
80cd0b1 @mcdonc garden
mcdonc authored
414 - A ``check_csrf`` view predicate was added. For example, you can now do
415 ``config.add_view(someview, check_csrf=True)``. When the predicate is
416 checked, if the ``csrf_token`` value in ``request.params`` matches the CSRF
417 token in the request's session, the view will be permitted to execute.
418 Otherwise, it will not be permitted to execute.
68c25d3 @mcdonc garden
mcdonc authored
419
098599b @mcdonc - Add ``Base.metadata.bind = engine`` to alchemy template, so that ta…
mcdonc authored
420 - Add ``Base.metadata.bind = engine`` to alchemy template, so that tables
421 defined imperatively will work.
422
423 Documentation
424 -------------
425
426 - update wiki2 SQLA tutorial with the changes required after inserting
427 ``Base.metadata.bind = engine`` into the alchemy scaffold.
428
ce1e86c @mcdonc prep for 1.4a1
mcdonc authored
429 1.4a1 (2012-09-16)
430 ==================
f6bd88e @mcdonc trivial change to poke jenkins (im in on an untrusted network and can…
mcdonc authored
431
a39dd2f @mcdonc - Add ``REMOTE_ADDR`` to the ``prequest`` WSGI environ dict for benef…
mcdonc authored
432 Bug Fixes
433 ---------
434
1794b4b @mcdonc note that this is a forward port
mcdonc authored
435 - Forward port from 1.3 branch: When no authentication policy was configured,
436 a call to ``pyramid.security.effective_principals`` would unconditionally
437 return the empty list. This was incorrect, it should have unconditionally
438 returned ``[Everyone]``, and now does.
8782def @mcdonc - When no authentication policy was configured, a call to
mcdonc authored
439
3074e78 @mcdonc garden
mcdonc authored
440 - Explicit url dispatch regexes can now contain colons.
441 https://github.com/Pylons/pyramid/issues/629
442
e652518 @mcdonc - On at least one 64-bit Ubuntu system under Python 3.2, using the
mcdonc authored
443 - On at least one 64-bit Ubuntu system under Python 3.2, using the
444 ``view_config`` decorator caused a ``RuntimeError: dictionary changed size
445 during iteration`` exception. It no longer does. See
446 https://github.com/Pylons/pyramid/issues/635 for more information.
447
8b26752 @blaflamme added entry to changes.txt for mako fix
blaflamme authored
448 - In Mako Templates lookup, check if the uri is already adjusted and bring
449 it back to an asset spec. Normally occurs with inherited templates or
450 included components.
451 https://github.com/Pylons/pyramid/issues/606
452 https://github.com/Pylons/pyramid/issues/607
453
7853bc0 @blaflamme garden
blaflamme authored
454 - In Mako Templates lookup, check for absolute uri (using mako directories)
455 when mixing up inheritance with asset specs.
456 https://github.com/Pylons/pyramid/issues/662
457
75a8ff4 @mmerickel updated CHANGES with accept-header bug fix
mmerickel authored
458 - HTTP Accept headers were not being normalized causing potentially
459 conflicting view registrations to go unnoticed. Two views that only
460 differ in the case ('text/html' vs. 'text/HTML') will now raise an error.
461 https://github.com/Pylons/pyramid/pull/620
462
a9289d9 @mcdonc - Forward-port from 1.3 branch: when registering multiple views with an
mcdonc authored
463 - Forward-port from 1.3 branch: when registering multiple views with an
464 ``accept`` predicate in a Pyramid application runing under Python 3, you
465 might have received a ``TypeError: unorderable types: function() <
466 function()`` exception.
467
de797c4 @mcdonc - Coverage and docs updates for custom JSON class.
mcdonc authored
468 Features
469 --------
a39dd2f @mcdonc - Add ``REMOTE_ADDR`` to the ``prequest`` WSGI environ dict for benef…
mcdonc authored
470
d246597 @mcdonc reclassify bug as feature
mcdonc authored
471 - Configurator.add_directive now accepts arbitrary callables like partials or
472 objects implementing ``__call__`` which dont have ``__name__`` and
473 ``__doc__`` attributes. See https://github.com/Pylons/pyramid/issues/621
474 and https://github.com/Pylons/pyramid/pull/647.
475
95f766b @mcdonc Subscriber predicates:
mcdonc authored
476 - Third-party custom view, route, and subscriber predicates can now be added
477 for use by view authors via
478 ``pyramid.config.Configurator.add_view_predicate``,
479 ``pyramid.config.Configurator.add_route_predicate`` and
480 ``pyramid.config.Configurator.add_subscriber_predicate``. So, for example,
0196b2a @mcdonc add docs for third-party view predicates
mcdonc authored
481 doing this::
482
483 config.add_view_predicate('abc', my.package.ABCPredicate)
484
485 Might allow a view author to do this in an application that configured that
486 predicate::
487
488 @view_config(abc=1)
489
95f766b @mcdonc Subscriber predicates:
mcdonc authored
490 Similar features exist for ``add_route``, and ``add_subscriber``. See
491 "Adding A Third Party View, Route, or Subscriber Predicate" in the Hooks
492 chapter for more information.
0196b2a @mcdonc add docs for third-party view predicates
mcdonc authored
493
735abf4 @mcdonc note conflict behavior change
mcdonc authored
494 Note that changes made to support the above feature now means that only
495 actions registered using the same "order" can conflict with one another.
496 It used to be the case that actions registered at different orders could
497 potentially conflict, but to my knowledge nothing ever depended on this
498 behavior (it was a bit silly).
499
de797c4 @mcdonc - Coverage and docs updates for custom JSON class.
mcdonc authored
500 - Custom objects can be made easily JSON-serializable in Pyramid by defining
501 a ``__json__`` method on the object's class. This method should return
502 values natively serializable by ``json.dumps`` (such as ints, lists,
503 dictionaries, strings, and so forth).
077fa3a @mcdonc add change note
mcdonc authored
504
e012aa1 @mcdonc allow __json__ and custom adapters to accept request arg
mcdonc authored
505 - The JSON renderer now allows for the definition of custom type adapters to
506 convert unknown objects to JSON serializations.
507
360f251 @mcdonc - As of this release, the ``request_method`` predicate, when used, wi…
mcdonc authored
508 - As of this release, the ``request_method`` predicate, when used, will also
509 imply that ``HEAD`` is implied when you use ``GET``. For example, using
510 ``@view_config(request_method='GET')`` is equivalent to using
561a443 @mcdonc fix example
mcdonc authored
511 ``@view_config(request_method=('GET', 'HEAD'))``. Using
360f251 @mcdonc - As of this release, the ``request_method`` predicate, when used, wi…
mcdonc authored
512 ``@view_config(request_method=('GET', 'POST')`` is equivalent to using
513 ``@view_config(request_method=('GET', 'HEAD', 'POST')``. This is because
514 HEAD is a variant of GET that omits the body, and WebOb has special support
515 to return an empty body when a HEAD is used.
15c40a1 @mcdonc readme
mcdonc authored
516
023c88b @mcdonc rename set_request_method to add_request_method. closes #683
mcdonc authored
517 - ``config.add_request_method`` has been introduced to support extending
2c25342 @mmerickel docs-deprecated set_request_property
mmerickel authored
518 request objects with arbitrary callables. This method expands on the
519 previous ``config.set_request_property`` by supporting methods as well as
520 properties. This method now causes less code to be executed at
521 request construction time than ``config.set_request_property`` in
522 version 1.3.
523
524 - Don't add a ``?`` to URLs generated by ``request.resource_url`` if the
fcb2095 @mcdonc garden
mcdonc authored
525 ``query`` argument is provided but empty.
526
2c25342 @mmerickel docs-deprecated set_request_property
mmerickel authored
527 - Don't add a ``?`` to URLs generated by ``request.route_url`` if the
fcb2095 @mcdonc garden
mcdonc authored
528 ``_query`` argument is provided but empty.
988035a @mcdonc add a change note
mcdonc authored
529
530 - The static view machinery now raises (rather than returns) ``HTTPNotFound``
531 and ``HTTPMovedPermanently`` exceptions, so these can be caught by the
cec2b05 @tshepang consistency
tshepang authored
532 Not Found View (and other exception views).
ea009a6 @blaflamme added docs and changes for using defs in mako renderer
blaflamme authored
533
54d3e3e @mcdonc add a whatsnew-1.4 document
mcdonc authored
534 - The Mako renderer now supports a def name in an asset spec. When the def
8b55a68 @mcdonc garden
mcdonc authored
535 name is present in the asset spec, the system will render the template def
536 within the template and will return the result. An example asset spec is
537 ``package:path/to/template#defname.mako``. This will render the def named
54d3e3e @mcdonc add a whatsnew-1.4 document
mcdonc authored
538 ``defname`` inside the ``template.mako`` template instead of rendering the
539 entire template. The old way of returning a tuple in the form
540 ``('defname', {})`` from the view is supported for backward compatibility,
8b55a68 @mcdonc garden
mcdonc authored
541
542 - The Chameleon ZPT renderer now accepts a macro name in an asset spec. When
543 the macro name is present in the asset spec, the system will render the
544 macro listed as a ``define-macro`` and return the result instead of
545 rendering the entire template. An example asset spec:
546 ``package:path/to/template#macroname.pt``. This will render the macro
547 defined as ``macroname`` within the ``template.pt`` template instead of the
548 entire templae.
61a57ea @mcdonc - When there is a predicate mismatch exception (seen when no view mat…
mcdonc authored
549
550 - When there is a predicate mismatch exception (seen when no view matches for
551 a given request due to predicates not working), the exception now contains
552 a textual description of the predicate which didn't match.
6b180cb @mcdonc - An ``add_permission`` directive method was added to the Configurato…
mcdonc authored
553
554 - An ``add_permission`` directive method was added to the Configurator. This
555 directive registers a free-standing permission introspectable into the
556 Pyramid introspection system. Frameworks built atop Pyramid can thus use
08c2217 @tshepang eliminate repeated "the" words
tshepang authored
557 the ``permissions`` introspectable category data to build a
6b180cb @mcdonc - An ``add_permission`` directive method was added to the Configurato…
mcdonc authored
558 comprehensive list of permissions supported by a running system. Before
559 this method was added, permissions were already registered in this
560 introspectable category as a side effect of naming them in an ``add_view``
561 call, this method just makes it possible to arrange for a permission to be
562 put into the ``permissions`` introspectable category without naming it
563 along with an associated view. Here's an example of usage of
564 ``add_permission``::
565
566 config = Configurator()
567 config.add_permission('view')
2c25342 @mmerickel docs-deprecated set_request_property
mmerickel authored
568
45b6e19 @mmerickel added cookie session changes to CHANGES.txt
mmerickel authored
569 - The ``UnencryptedCookieSessionFactoryConfig`` now accepts
570 ``signed_serialize`` and ``signed_deserialize`` hooks which may be used
571 to influence how the sessions are marshalled (by default this is done
572 with HMAC+pickle).
573
28dba04 @mcdonc - ``pyramid.testing.DummyRequest`` now supports methods supplied by the
mcdonc authored
574 - ``pyramid.testing.DummyRequest`` now supports methods supplied by the
575 ``pyramid.util.InstancePropertyMixin`` class such as ``set_property``.
576
7359873 @mcdonc - Request properties and methods added via ``config.set_request_prope…
mcdonc authored
577 - Request properties and methods added via ``config.set_request_property`` or
578 ``config.add_request_method`` are now available to tweens.
579
580 - Request properties and methods added via ``config.set_request_property`` or
581 ``config.add_request_method`` are now available in the request object
582 returned from ``pyramid.paster.bootstrap``.
583
dc8b49f @mcdonc garden
mcdonc authored
584 - ``request.context`` of environment request during ``bootstrap`` is now the
585 root object if a context isn't already set on a provided request.
586
07cb8f0 @mcdonc add pyramid.decorator.reify as an API. Closes #682
mcdonc authored
587 - The ``pyramid.decorator.reify`` function is now an API, and was added to
588 the API documentation.
589
97150cc @mcdonc merge jinty's testConfig code
mcdonc authored
590 - Added the ``pyramid.testing.testConfig`` context manager, which can be used
591 to generate a configurator in a test, e.g. ``with testing.testConfig(...):``.
592
64452ed @mcdonc rename subrequest to invoke_subrequest
mcdonc authored
593 - Users can now invoke a subrequest from within view code using a new
594 ``request.invoke_subrequest`` API.
37d2c22 @mcdonc docs and test
mcdonc authored
595
2c25342 @mmerickel docs-deprecated set_request_property
mmerickel authored
596 Deprecations
597 ------------
598
9cdb286 @mcdonc readd set_request_property to docs (just so when people run across it…
mcdonc authored
599 - The ``pyramid.config.Configurator.set_request_property`` has been
600 documentation-deprecated. The method remains usable but the more
023c88b @mcdonc rename set_request_method to add_request_method. closes #683
mcdonc authored
601 featureful ``pyramid.config.Configurator.add_request_method`` should be
9cdb286 @mcdonc readd set_request_property to docs (just so when people run across it…
mcdonc authored
602 used in its place (it has all of the same capabilities but can also extend
603 the request object with methods).
ebcdc7c @mcdonc - It is no longer possible to pass an environ dictionary directly to
mcdonc authored
604
605 Backwards Incompatibilities
606 ---------------------------
607
25d3ddf @mcdonc garden
mcdonc authored
608 - The Pyramid router no longer adds the values ``bfg.routes.route`` or
ebcdc7c @mcdonc - It is no longer possible to pass an environ dictionary directly to
mcdonc authored
609 ``bfg.routes.matchdict`` to the request's WSGI environment dictionary.
610 These values were docs-deprecated in ``repoze.bfg`` 1.0 (effectively seven
611 minor releases ago). If your code depended on these values, use
612 request.matched_route and request.matchdict instead.
613
614 - It is no longer possible to pass an environ dictionary directly to
615 ``pyramid.traversal.ResourceTreeTraverser.__call__`` (aka
616 ``ModelGraphTraverser.__call__``). Instead, you must pass a request
617 object. Passing an environment instead of a request has generated a
618 deprecation warning since Pyramid 1.1.
619
620 - Pyramid will no longer work properly if you use the
621 ``webob.request.LegacyRequest`` as a request factory. Instances of the
622 LegacyRequest class have a ``request.path_info`` which return a string.
623 This Pyramid release assumes that ``request.path_info`` will
624 unconditionally be Unicode.
625
3d42722 @mcdonc - The functions from ``pyramid.chameleon_zpt`` and ``pyramid.chameleo…
mcdonc authored
626 - The functions from ``pyramid.chameleon_zpt`` and ``pyramid.chameleon_text``
627 named ``get_renderer``, ``get_template``, ``render_template``, and
628 ``render_template_to_response`` have been removed. These have issued a
629 deprecation warning upon import since Pyramid 1.0. Use
630 ``pyramid.renderers.get_renderer()``,
631 ``pyramid.renderers.get_renderer().implementation()``,
632 ``pyramid.renderers.render()`` or ``pyramid.renderers.render_to_response``
633 respectively instead of these functions.
634
94a6f35 @mcdonc - The ``pyramid.configuration`` module was removed. It had been depr…
mcdonc authored
635 - The ``pyramid.configuration`` module was removed. It had been deprecated
636 since Pyramid 1.0 and printed a deprecation warning upon its use. Use
637 ``pyramid.config`` instead.
638
b274d05 @mcdonc - The ``pyramid.paster.PyramidTemplate`` API was removed. It had been
mcdonc authored
639 - The ``pyramid.paster.PyramidTemplate`` API was removed. It had been
640 deprecated since Pyramid 1.1 and issued a warning on import. If your code
641 depended on this, adjust your code to import
642 ``pyramid.scaffolds.PyramidTemplate`` instead.
643
ef2e517 @mcdonc - The ``pyramid.settings.get_settings()`` API was removed. It had been
mcdonc authored
644 - The ``pyramid.settings.get_settings()`` API was removed. It had been
645 printing a deprecation warning since Pyramid 1.0. If your code depended on
646 this API, use ``pyramid.threadlocal.get_current_registry().settings``
647 instead or use the ``settings`` attribute of the registry available from
648 the request (``request.registry.settings``).
649
69e0aad @mcdonc - These APIs from the ``pyramid.testing`` module were removed. They …
mcdonc authored
650 - These APIs from the ``pyramid.testing`` module were removed. They have
651 been printing deprecation warnings since Pyramid 1.0:
652
653 * ``registerDummySecurityPolicy``, use
654 ``pyramid.config.Configurator.testing_securitypolicy`` instead.
655
656 * ``registerResources`` (aka ``registerModels``, use
657 ``pyramid.config.Configurator.testing_resources`` instead.
658
659 * ``registerEventListener``, use
660 ``pyramid.config.Configurator.testing_add_subscriber`` instead.
661
662 * ``registerTemplateRenderer`` (aka `registerDummyRenderer``), use
663 ``pyramid.config.Configurator.testing_add_template`` instead.
664
665 * ``registerView``, use ``pyramid.config.Configurator.add_view`` instead.
666
667 * ``registerUtility``, use
668 ``pyramid.config.Configurator.registry.registerUtility`` instead.
669
670 * ``registerAdapter``, use
671 ``pyramid.config.Configurator.registry.registerAdapter`` instead.
672
673 * ``registerSubscriber``, use
674 ``pyramid.config.Configurator.add_subscriber`` instead.
675
676 * ``registerRoute``, use
677 ``pyramid.config.Configurator.add_route`` instead.
678
679 * ``registerSettings``, use
680 ``pyramid.config.Configurator.add_settings`` instead.
681
64452ed @mcdonc rename subrequest to invoke_subrequest
mcdonc authored
682 - In Pyramid 1.3 and previous, the ``__call__`` method of a Response object
683 was invoked before any finished callbacks were executed. As of this
684 release, the ``__call__`` method of a Response object is invoked *after*
685 finished callbacks are executed. This is in support of the
686 ``request.invoke_subrequest`` feature.
687
b72ba1a @mcdonc add upgrading chapter, make docs render again
mcdonc authored
688 Documentation
689 -------------
690
691 - Added an "Upgrading Pyramid" chapter to the narrative documentation. It
07cb8f0 @mcdonc add pyramid.decorator.reify as an API. Closes #682
mcdonc authored
692 describes how to cope with deprecations and removals of Pyramid APIs and
693 how to show Pyramid-generated deprecation warnings while running tests and
694 while running a server.
b72ba1a @mcdonc add upgrading chapter, make docs render again
mcdonc authored
695
37d2c22 @mcdonc docs and test
mcdonc authored
696 - Added a "Invoking a Subrequest" chapter to the documentation. It describes
64452ed @mcdonc rename subrequest to invoke_subrequest
mcdonc authored
697 how to use the new ``request.invoke_subrequest`` API.
37d2c22 @mcdonc docs and test
mcdonc authored
698
ebcdc7c @mcdonc - It is no longer possible to pass an environ dictionary directly to
mcdonc authored
699 Dependencies
700 ------------
701
702 - Pyramid now requires WebOb 1.2b3+ (the prior Pyramid release only relied on
703 1.2dev+). This is to ensure that we obtain a version of WebOb that returns
704 ``request.path_info`` as text.
705
Something went wrong with that request. Please try again.