Chris McDonough
2011-07-15 999d44cf53e2213be8df881c2b407986b462c79c
commit | author | age
999d44 1 1.1b3 (2011-07-15)
CM 2 ==================
2ad827 3
CM 4 Features
5 --------
6
7 - Fix corner case to ease semifunctional testing of views: create a new
8   rendererinfo to clear out old registry on a rescan.  See
9   https://github.com/Pylons/pyramid/pull/234.
10
56d0fe 11 - New API class: ``pyramid.static.static_view``.  This supersedes the
100a57 12   deprecated ``pyramid.view.static`` class.  ``pyramid.static.static_view``
CM 13   by default serves up documents as the result of the request's
14   ``path_info``, attribute rather than it's ``subpath`` attribute (the
15   inverse was true of ``pyramid.view.static``, and still is).
16   ``pyramid.static.static_view`` exposes a ``use_subpath`` flag for use when
10408c 17   you want the static view to behave like the older deprecated version.
56d0fe 18
c515d7 19 - A new API function ``pyramid.paster.bootstrap`` has been added to make
CM 20   writing scripts that bootstrap a Pyramid environment easier, e.g.::
21
22       from pyramid.paster import bootstrap
23       info = bootstrap('/path/to/my/development.ini')
24       request = info['request']
25       print request.route_url('myroute')
26
27 - A new API function ``pyramid.scripting.prepare`` has been added.  It is a
28   lower-level analogue of ``pyramid.paster.boostrap`` that accepts a request
29   and a registry instead of a config file argument, and is used for the same
30   purpose::
31
32       from pyramid.scripting import prepare
33       info = prepare(registry=myregistry)
34       request = info['request']
35       print request.route_url('myroute')
36
37 - A new API function ``pyramid.scripting.make_request`` has been added.  The
38   resulting request will have a ``registry`` attribute.  It is meant to be
39   used in conjunction with ``pyramid.scripting.prepare`` and/or
40   ``pyramid.paster.bootstrap`` (both of which accept a request as an
41   argument)::
42
43       from pyramid.scripting import make_request
44       request = make_request('/')
45
46 - New API attribute ``pyramid.config.global_registries`` is an iterable
47   object that contains references to every Pyramid registry loaded into the
48   current process via ``pyramid.config.Configurator.make_app``.  It also has
49   a ``last`` attribute containing the last registry loaded.  This is used by
50   the scripting machinery, and is available for introspection.
51
56d0fe 52 Deprecations
CM 53 ------------
54
55 - The ``pyramid.view.static`` class has been deprecated in favor of the newer
56   ``pyramid.static.static_view`` class.  A deprecation warning is raised when
57   it is used.  You should replace it with a reference to
58   ``pyramid.static.static_view`` with the ``use_subpath=True`` argument.
59
5b5cd6 60 Bug Fixes
CM 61 ---------
62
63 - Without a mo-file loaded for the combination of domain/locale,
64   ``pyramid.i18n.Localizer.pluralize`` run using that domain/locale
acc2d3 65   combination raised an inscrutable "translations object has no attr
CM 66   'plural'" error.  Now, instead it "works" (it uses a germanic pluralization
67   by default).  It's nonsensical to try to pluralize something without
68   translations for that locale/domain available, but this behavior matches
69   the behavior of ``pyramid.i18n.Localizer.translate`` so it's at least
70   consistent; see https://github.com/Pylons/pyramid/issues/235.
5b5cd6 71
d4ccb8 72 1.1b2 (2011-07-13)
CM 73 ==================
82efa4 74
e573d4 75 Features
CM 76 --------
77
78 - New environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and new
79   configuration file value ``prevent_http_cache``.  These are synomymous and
80   allow you to prevent HTTP cache headers from being set by Pyramid's
81   ``http_cache`` machinery globally in a process.  see the "Influencing HTTP
82   Caching" section of the "View Configuration" narrative chapter and the
83   detailed documentation for this setting in the "Environment Variables and
84   Configuration Settings" narrative chapter.
85
82efa4 86 Behavior Changes
CM 87 ----------------
88
89 - Previously, If a ``BeforeRender`` event subscriber added a value via the
90   ``__setitem__`` or ``update`` methods of the event object with a key that
91   already existed in the renderer globals dictionary, a ``KeyError`` was
92   raised.  With the deprecation of the "add_renderer_globals" feature of the
93   configurator, there was no way to override an existing value in the
94   renderer globals dictionary that already existed.  Now, the event object
95   will overwrite an older value that is already in the globals dictionary
96   when its ``__setitem__`` or ``update`` is called (as well as the new
97   ``setdefault`` method), just like a plain old dictionary.  As a result, for
98   maximum interoperability with other third-party subscribers, if you write
99   an event subscriber meant to be used as a BeforeRender subscriber, your
100   subscriber code will now need to (using ``.get`` or ``__contains__`` of the
101   event object) ensure no value already exists in the renderer globals
102   dictionary before setting an overriding value.
103
94ab24 104 Bug Fixes
CM 105 ---------
106
107 - The ``Configurator.add_route`` method allowed two routes with the same
108   route to be added without an intermediate ``config.commit()``.  If you now
109   receive a ``ConfigurationError`` at startup time that appears to be
110   ``add_route`` related, you'll need to either a) ensure that all of your
111   route names are unique or b) call ``config.commit()`` before adding a
112   second route with the name of a previously added name or c) use a
113   Configurator that works in ``autocommit`` mode.
114
aec6b2 115 - The ``pyramid_routesalchemy`` and ``pyramid_alchemy`` scaffolds
CM 116   inappropriately used ``DBSession.rollback()`` instead of
117   ``transaction.abort()`` in one place.
118
d05117 119 - We now clear ``request.response`` before we invoke an exception view; an
CM 120   exception view will be working with a request.response that has not been
121   touched by any code prior to the exception.
122
873d9b 123 - Views associated with routes with spaces in the route name may not have
CM 124   been looked up correctly when using Pyramid with ``zope.interface`` 3.6.4
d4ccb8 125   and better.  See https://github.com/Pylons/pyramid/issues/232.
873d9b 126
aec6b2 127 Documentation
CM 128 -------------
129
130 - Wiki2 (SQLAlchemy + URL Dispatch) tutorial ``models.initialize_sql`` didn't
131   match the ``pyramid_routesalchemy`` scaffold function of the same name; it
132   didn't get synchronized when it was changed in the scaffold.
133
e573d4 134 - New documentation section in View Configuration narrative chapter:
CM 135   "Influencing HTTP Caching".
136
a36fdb 137 1.1b1 (2011-07-10)
CM 138 ==================
0fa199 139
CM 140 Features
141 --------
142
756500 143 - It is now possible to invoke ``paster pshell`` even if the paste ini file
CM 144   section name pointed to in its argument is not actually a Pyramid WSGI
145   application.  The shell will work in a degraded mode, and will warn the
146   user.  See "The Interactive Shell" in the "Creating a Pyramid Project"
147   narrative documentation section.
148
149 - ``paster pshell`` now offers more built-in global variables by default
150   (including ``app`` and ``settings``).  See "The Interactive Shell" in the
151   "Creating a Pyramid Project" narrative documentation section.
152
153 - It is now possible to add a ``[pshell]`` section to your application's .ini
154   configuration file, which influences the global names available to a pshell
155   session.  See "Extending the Shell" in the "Creating a Pyramid Project"
156   narrative documentation chapter.
157
fca1ef 158 - The ``config.scan`` method has grown a ``**kw`` argument.  ``kw`` argument
CM 159   represents a set of keyword arguments to pass to the Venusian ``Scanner``
160   object created by Pyramid.  (See the Venusian documentation for more
161   information about ``Scanner``).
162
6a0602 163 - New request property: ``json_body``. This property will return the
CM 164   JSON-decoded variant of the request body.  If the request body is not
165   well-formed JSON, this property will raise an exception.
b78eff 166
0fa199 167 - A new value ``http_cache`` can be used as a view configuration
CM 168   parameter.
169
170   When you supply an ``http_cache`` value to a view configuration, the
171   ``Expires`` and ``Cache-Control`` headers of a response generated by the
172   associated view callable are modified.  The value for ``http_cache`` may be
173   one of the following:
174
175   - A nonzero integer.  If it's a nonzero integer, it's treated as a number
176     of seconds.  This number of seconds will be used to compute the
177     ``Expires`` header and the ``Cache-Control: max-age`` parameter of
178     responses to requests which call this view.  For example:
179     ``http_cache=3600`` instructs the requesting browser to 'cache this
180     response for an hour, please'.
181
182   - A ``datetime.timedelta`` instance.  If it's a ``datetime.timedelta``
183     instance, it will be converted into a number of seconds, and that number
184     of seconds will be used to compute the ``Expires`` header and the
185     ``Cache-Control: max-age`` parameter of responses to requests which call
186     this view.  For example: ``http_cache=datetime.timedelta(days=1)``
187     instructs the requesting browser to 'cache this response for a day,
188     please'.
189
190   - Zero (``0``).  If the value is zero, the ``Cache-Control`` and
191     ``Expires`` headers present in all responses from this view will be
192     composed such that client browser cache (and any intermediate caches) are
193     instructed to never cache the response.
194
195   - A two-tuple.  If it's a two tuple (e.g. ``http_cache=(1,
196     {'public':True})``), the first value in the tuple may be a nonzero
197     integer or a ``datetime.timedelta`` instance; in either case this value
198     will be used as the number of seconds to cache the response.  The second
199     value in the tuple must be a dictionary.  The values present in the
200     dictionary will be used as input to the ``Cache-Control`` response
201     header.  For example: ``http_cache=(3600, {'public':True})`` means 'cache
202     for an hour, and add ``public`` to the Cache-Control header of the
203     response'.  All keys and values supported by the
204     ``webob.cachecontrol.CacheControl`` interface may be added to the
205     dictionary.  Supplying ``{'public':True}`` is equivalent to calling
206     ``response.cache_control.public = True``.
207
208   Providing a non-tuple value as ``http_cache`` is equivalent to calling
209   ``response.cache_expires(value)`` within your view's body.
210
211   Providing a two-tuple value as ``http_cache`` is equivalent to calling
212   ``response.cache_expires(value[0], **value[1])`` within your view's body.
213
214   If you wish to avoid influencing, the ``Expires`` header, and instead wish
215   to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache``
216   with the first element of ``None``, e.g.: ``(None, {'public':True})``.
217
b44aab 218 Bug Fixes
CM 219 ---------
220
221 - Framework wrappers of the original view (such as http_cached and so on)
222   relied on being able to trust that the response they were receiving was an
223   IResponse.  It wasn't always, because the response was resolved by the
224   router instead of early in the view wrapping process.  This has been fixed.
225
6a0602 226 Documentation
CM 227 -------------
228
229 - Added a section in the "Webob" chapter named "Dealing With A JSON-Encoded
230   Request Body" (usage of ``request.json_body``).
231
756500 232 Behavior Changes
CM 233 ----------------
234
235 - The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands
236   now take a single argument in the form ``/path/to/config.ini#sectionname``
237   rather than the previous 2-argument spelling ``/path/to/config.ini
238   sectionname``.  ``#sectionname`` may be omitted, in which case ``#main`` is
239   assumed.
240
b9c0e7 241 1.1a4 (2011-07-01)
CM 242 ==================
9395f0 243
CM 244 Bug Fixes
245 ---------
246
247 - ``pyramid.testing.DummyRequest`` now raises deprecation warnings when
248   attributes deprecated for ``pyramid.request.Request`` are accessed (like
249   ``response_content_type``).  This is for the benefit of folks running unit
250   tests which use DummyRequest instead of a "real" request, so they know
251   things are deprecated without necessarily needing a functional test suite.
252
2ea5c1 253 - The ``pyramid.events.subscriber`` directive behaved contrary to the
CM 254   documentation when passed more than one interface object to its
255   constructor.  For example, when the following listener was registered::
256
257      @subscriber(IFoo, IBar)
258      def expects_ifoo_events_and_ibar_events(event):
259          print event
260
261   The Events chapter docs claimed that the listener would be registered and
262   listening for both ``IFoo`` and ``IBar`` events.  Instead, it registered an
263   "object event" subscriber which would only be called if an IObjectEvent was
264   emitted where the object interface was ``IFoo`` and the event interface was
265   ``IBar``.
266
267   The behavior now matches the documentation. If you were relying on the
268   buggy behavior of the 1.0 ``subscriber`` directive in order to register an
269   object event subscriber, you must now pass a sequence to indicate you'd
8519c9 270   like to register a subscriber for an object event. e.g.::
2ea5c1 271
CM 272      @subscriber([IFoo, IBar])
273      def expects_object_event(object, event):
274          print object, event
275
c1f3d0 276 Features
CM 277 --------
278
279 - Add JSONP renderer (see "JSONP renderer" in the Renderers chapter of the
280   documentation).
281
b7f33b 282 Deprecations
CM 283 ------------
284
285 - Deprecated the ``set_renderer_globals_factory`` method of the Configurator
286   and the ``renderer_globals`` Configurator constructor parameter.
287
05a1b4 288 Documentation
CM 289 -------------
290
6c9959 291 - The Wiki and Wiki2 tutorial "Tests" chapters each had two bugs: neither did
CM 292   told the user to depend on WebTest, and 2 tests failed in each as the
293   result of changes to Pyramid itself.  These issues have been fixed.
05a1b4 294
e21ed8 295 - Move 1.0.X CHANGES.txt entries to HISTORY.txt.
CM 296
1ba6fe 297 1.1a3 (2011-06-26)
CM 298 ==================
05fd08 299
8bd6cf 300 Features
CM 301 --------
302
303 - Added ``mako.preprocessor`` config file parameter; allows for a Mako
304   preprocessor to be specified as a Python callable or Python dotted name.
305   See https://github.com/Pylons/pyramid/pull/183 for rationale.
306
05fd08 307 Bug fixes
CM 308 ---------
309
310 - Pyramid would raise an AttributeError in the Configurator when attempting
311   to set a ``__text__`` attribute on a custom predicate that was actually a
312   classmethod.  See https://github.com/Pylons/pyramid/pull/217 .
313
d8c55c 314 - Accessing or setting deprecated response_* attrs on request
CM 315   (e.g. ``response_content_type``) now issues a deprecation warning at access
316   time rather than at rendering time.
05fd08 317
cc85e7 318 1.1a2 (2011-06-22)
CM 319 ==================
c724f0 320
d74d53 321 Bug Fixes
CM 322 ---------
323
324 - 1.1a1 broke Akhet by not providing a backwards compatibility import shim
325   for ``pyramid.paster.PyramidTemplate``.  Now one has been added, although a
cc85e7 326   deprecation warning is emitted when Akhet imports it.
d74d53 327
6ed33e 328 - If multiple specs were provided in a single call to
CM 329   ``config.add_translation_dirs``, the directories were inserted into the
330   beginning of the directory list in the wrong order: they were inserted in
331   the reverse of the order they were provided in the ``*specs`` list (items
4f11dc 332   later in the list were added before ones earlier in the list).  This is now
CM 333   fixed.
6ed33e 334
c724f0 335 Backwards Incompatibilities
CM 336 ---------------------------
337
338 - The pyramid Router attempted to set a value into the key
339   ``environ['repoze.bfg.message']`` when it caught a view-related exception
cc85e7 340   for backwards compatibility with applications written for ``repoze.bfg``
CM 341   during error handling.  It did this by using code that looked like so::
c724f0 342
CM 343                     # "why" is an exception object
344                     try: 
345                         msg = why[0]
346                     except:
347                         msg = ''
348
349                     environ['repoze.bfg.message'] = msg
350
351   Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in
352   Pyramid 1.0.  Our standing policy is to not remove features after a
353   deprecation for two full major releases, so this code was originally slated
354   to be removed in Pyramid 1.2.  However, computing the
355   ``repoze.bfg.message`` value was the source of at least one bug found in
356   the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a
357   foolproof way to both preserve backwards compatibility and to fix the bug.
358   Therefore, the code which sets the value has been removed in this release.
359   Code in exception views which relies on this value's presence in the
360   environment should now use the ``exception`` attribute of the request
361   (e.g. ``request.exception[0]``) to retrieve the message instead of relying
362   on ``request.environ['repoze.bfg.message']``.
363
83549e 364 1.1a1 (2011-06-20)
CM 365 ==================
959523 366
8027ad 367 Documentation
JD 368 -------------
369
af71c2 370 - The term "template" used to refer to both "paster templates" and "rendered
CM 371   templates" (templates created by a rendering engine.  i.e. Mako, Chameleon,
372   Jinja, etc.).  "Paster templates" will now be refered to as "scaffolds",
373   whereas the name for "rendered templates" will remain as "templates."
8027ad 374
88f967 375 - The ``wiki`` (ZODB+Traversal) tutorial was updated slightly.
CM 376
377 - The ``wiki2`` (SQLA+URL Dispatch) tutorial was updated slightly.
378
d2973d 379 - Make ``pyramid.interfaces.IAuthenticationPolicy`` and
CM 380   ``pyramid.interfaces.IAuthorizationPolicy`` public interfaces, and refer to
381   them within the ``pyramid.authentication`` and ``pyramid.authorization``
382   API docs.
383
384 - Render the function definitions for each exposed interface in
385   ``pyramid.interfaces``.
386
cae85d 387 - Add missing docs reference to
CM 388   ``pyramid.config.Configurator.set_view_mapper`` and refer to it within
389   Hooks chapter section named "Using a View Mapper".
390
f6799b 391 - Added section to the "Environment Variables and ``.ini`` File Settings"
CM 392   chapter in the narrative documentation section entitled "Adding a Custom
393   Setting".
394
2a1c3f 395 - Added documentation for a "multidict" (e.g. the API of ``request.POST``) as
CM 396   interface API documentation.
397
e725cf 398 - Added a section to the "URL Dispatch" narrative chapter regarding the new
CM 399   "static" route feature.
400
2ce652 401 - Added "What's New in Pyramid 1.1" to HTML rendering of documentation.
CM 402
0ca4bb 403 - Added API docs for ``pyramid.authentication.SessionAuthenticationPolicy``.
CM 404
f8f08b 405 - Added API docs for ``pyramid.httpexceptions.exception_response``.
1ffb8e 406
CM 407 - Added "HTTP Exceptions" section to Views narrative chapter including a
f8f08b 408   description of ``pyramid.httpexceptions.exception_response``.
1ffb8e 409
fcbd7b 410 Features
CM 411 --------
4d9260 412
f3e62c 413 - Add support for language fallbacks: when trying to translate for a
WA 414   specific territory (such as ``en_GB``) fall back to translations
415   for the language (ie ``en``). This brings the translation behaviour in line
416   with GNU gettext and fixes partially translated texts when using C
417   extensions.
418
0ca4bb 419 - New authentication policy:
CM 420   ``pyramid.authentication.SessionAuthenticationPolicy``, which uses a session
421   to store credentials.
422
4d9260 423 - Accessing the ``response`` attribute of a ``pyramid.request.Request``
CM 424   object (e.g. ``request.response`` within a view) now produces a new
425   ``pyramid.response.Response`` object.  This feature is meant to be used
426   mainly when a view configured with a renderer needs to set response
db51c0 427   attributes: all renderers will use the Response object implied by
CM 428   ``request.response`` as the response object returned to the router.
429
430   ``request.response`` can also be used by code in a view that does not use a
431   renderer, however the response object that is produced by
432   ``request.response`` must be returned when a renderer is not in play (it is
433   not a "global" response).
fcbd7b 434
CM 435 - Integers and longs passed as ``elements`` to ``pyramid.url.resource_url``
436   or ``pyramid.request.Request.resource_url`` e.g. ``resource_url(context,
437   request, 1, 2)`` (``1`` and ``2`` are the ``elements``) will now be
438   converted implicitly to strings in the result.  Previously passing integers
439   or longs as elements would cause a TypeError.
440
296ee2 441 - ``pyramid_alchemy`` paster template now uses ``query.get`` rather than
CM 442   ``query.filter_by`` to take better advantage of identity map caching.
443
444 - ``pyramid_alchemy`` paster template now has unit tests.
445
2242e6 446 - Added ``pyramid.i18n.make_localizer`` API (broken out from
CM 447   ``get_localizer`` guts).
448
ba2ac1 449 - An exception raised by a NewRequest event subscriber can now be caught by
CM 450   an exception view.
451
b32552 452 - It is now possible to get information about why Pyramid raised a Forbidden
CM 453   exception from within an exception view.  The ``ACLDenied`` object returned
454   by the ``permits`` method of each stock authorization policy
455   (``pyramid.interfaces.IAuthorizationPolicy.permits``) is now attached to
456   the Forbidden exception as its ``result`` attribute.  Therefore, if you've
457   created a Forbidden exception view, you can see the ACE, ACL, permission,
458   and principals involved in the request as
459   eg. ``context.result.permission``, ``context.result.acl``, etc within the
460   logic of the Forbidden exception view.
461
474df5 462 - Don't explicitly prevent the ``timeout`` from being lower than the
CM 463   ``reissue_time`` when setting up an ``AuthTktAuthenticationPolicy``
464   (previously such a configuration would raise a ``ValueError``, now it's
465   allowed, although typically nonsensical).  Allowing the nonsensical
466   configuration made the code more understandable and required fewer tests.
467
99a32e 468 - A new paster command named ``paster pviews`` was added.  This command
CM 469   prints a summary of potentially matching views for a given path.  See the
470   section entitled "Displaying Matching Views for a Given URL" in the "View
471   Configuration" chapter of the narrative documentation for more information.
472
e725cf 473 - The ``add_route`` method of the Configurator now accepts a ``static``
CM 474   argument.  If this argument is ``True``, the added route will never be
475   considered for matching when a request is handled.  Instead, it will only
476   be useful for URL generation via ``route_url`` and ``route_path``.  See the
477   section entitled "Static Routes" in the URL Dispatch narrative chapter for
478   more information.
479
966b5c 480 - A default exception view for the context
99edc5 481   ``pyramid.interfaces.IExceptionResponse`` is now registered by default.
CM 482   This means that an instance of any exception response class imported from
483   ``pyramid.httpexceptions`` (such as ``HTTPFound``) can now be raised from
484   within view code; when raised, this exception view will render the
485   exception to a response.
1ffb8e 486
f8f08b 487 - A function named ``pyramid.httpexceptions.exception_response`` is a
CM 488   shortcut that can be used to create HTTP exception response objects using
489   an HTTP integer status code.
1ffb8e 490
CM 491 - The Configurator now accepts an additional keyword argument named
966b5c 492   ``exceptionresponse_view``.  By default, this argument is populated with a
CM 493   default exception view function that will be used when a response is raised
494   as an exception. When ``None`` is passed for this value, an exception view
495   for responses will not be registered.  Passing ``None`` returns the
496   behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception
497   will propagate to middleware and to the WSGI server).
498
499 - The ``pyramid.request.Request`` class now has a ``ResponseClass`` interface
500   which points at ``pyramid.response.Response``.
501
8cbbd9 502 - The ``pyramid.response.Response`` class now has a ``RequestClass``
CM 503   interface which points at ``pyramid.request.Request``.
1ffb8e 504
d868ff 505 - It is now possible to return an arbitrary object from a Pyramid view
CM 506   callable even if a renderer is not used, as long as a suitable adapter to
507   ``pyramid.interfaces.IResponse`` is registered for the type of the returned
1a6fc7 508   object by using the new
CM 509   ``pyramid.config.Configurator.add_response_adapter`` API.  See the section
510   in the Hooks chapter of the documentation entitled "Changing How Pyramid
511   Treats View Responses".
df15ed 512
99edc5 513 - The Pyramid router will now, by default, call the ``__call__`` method of
CM 514   WebOb response objects when returning a WSGI response.  This means that,
515   among other things, the ``conditional_response`` feature of WebOb response
516   objects will now behave properly.
df15ed 517
920990 518 - New method named ``pyramid.request.Request.is_response``.  This method
CM 519   should be used instead of the ``pyramid.view.is_response`` function, which
520   has been deprecated.
e39ddf 521
JG 522 Bug Fixes
523 ---------
524
0fd8ea 525 - URL pattern markers used in URL dispatch are permitted to specify a custom
CM 526   regex. For example, the pattern ``/{foo:\d+}`` means to match ``/12345``
527   (foo==12345 in the match dictionary) but not ``/abc``. However, custom
0a0edf 528   regexes in a pattern marker which used squiggly brackets did not work. For
CM 529   example, ``/{foo:\d{4}}`` would fail to match ``/1234`` and
530   ``/{foo:\d{1,2}}`` would fail to match ``/1`` or ``/11``. One level of
531   inner squiggly brackets is now recognized so that the prior two patterns
532   given as examples now work. See also
533   https://github.com/Pylons/pyramid/issues/#issue/123.
534
535 - Don't send port numbers along with domain information in cookies set by
115c71 536   AuthTktCookieHelper (see https://github.com/Pylons/pyramid/issues/131).
CM 537
538 - ``pyramid.url.route_path`` (and the shortcut
539   ``pyramid.request.Request.route_url`` method) now include the WSGI
b596e1 540   SCRIPT_NAME at the front of the path if it is not empty (see
CM 541   https://github.com/Pylons/pyramid/issues/135).
542
543 - ``pyramid.testing.DummyRequest`` now has a ``script_name`` attribute (the
0b2629 544   empty string).
CM 545
546 - Don't quote ``:@&+$,`` symbols in ``*elements`` passed to
547   ``pyramid.url.route_url`` or ``pyramid.url.resource_url`` (see
548   https://github.com/Pylons/pyramid/issues#issue/141).
549
550 - Include SCRIPT_NAME in redirects issued by
551   ``pyramid.view.append_slash_notfound_view`` (see
552   https://github.com/Pylons/pyramid/issues#issue/149).
553
554 - Static views registered with ``config.add_static_view`` which also included
555   a ``permission`` keyword argument would not work as expected, because
556   ``add_static_view`` also registered a route factory internally.  Because a
557   route factory was registered internally, the context checked by the Pyramid
8af47b 558   permission machinery never had an ACL.  ``add_static_view`` no longer
CM 559   registers a route with a factory, so the default root factory will be used.
560
561 - ``config.add_static_view`` now passes extra keyword arguments it receives
562   to ``config.add_route`` (calling add_static_view is mostly logically
563   equivalent to adding a view of the type ``pyramid.static.static_view``
564   hooked up to a route with a subpath).  This makes it possible to pass e.g.,
29a850 565   ``factory=`` to ``add_static_view`` to protect a particular static view
CM 566   with a custom ACL.
567
568 - ``testing.DummyRequest`` used the wrong registry (the global registry) as
569   ``self.registry`` if a dummy request was created *before* ``testing.setUp``
570   was executed (``testing.setUp`` pushes a local registry onto the
571   threadlocal stack). Fixed by implementing ``registry`` as a property for
572   DummyRequest instead of eagerly assigning an attribute.
573   See also https://github.com/Pylons/pyramid/issues/165
574
ba0a5f 575 - When visiting a URL that represented a static view which resolved to a
CM 576   subdirectory, the ``index.html`` of that subdirectory would not be served
577   properly.  Instead, a redirect to ``/subdir`` would be issued.  This has
578   been fixed, and now visiting a subdirectory that contains an ``index.html``
579   within a static view returns the index.html properly.  See also
580   https://github.com/Pylons/pyramid/issues/67.
581
4d9260 582 - Redirects issued by a static view did not take into account any existing
CM 583   ``SCRIPT_NAME`` (such as one set by a url mapping composite).  Now they do.
584
585 - The ``pyramid.wsgi.wsgiapp2`` decorator did not take into account the
586   ``SCRIPT_NAME`` in the origin request.
587
588 - The ``pyramid.wsgi.wsgiapp2`` decorator effectively only worked when it
589   decorated a view found via traversal; it ignored the ``PATH_INFO`` that was
590   part of a url-dispatch-matched view.
591
592 Deprecations
593 ------------
594
595 - Deprecated all assignments to ``request.response_*`` attributes (for
596   example ``request.response_content_type = 'foo'`` is now deprecated).
ed7ffe 597   Assignments and mutations of assignable request attributes that were
CM 598   considered by the framework for response influence are now deprecated:
599   ``response_content_type``, ``response_headerlist``, ``response_status``,
600   ``response_charset``, and ``response_cache_for``.  Instead of assigning
601   these to the request object for later detection by the rendering machinery,
602   users should use the appropriate API of the Response object created by
603   accessing ``request.response`` (e.g. code which does
604   ``request.response_content_type = 'abc'`` should be changed to
605   ``request.response.content_type = 'abc'``).
606
607 - Passing view-related parameters to
608   ``pyramid.config.Configurator.add_route`` is now deprecated.  Previously, a
609   view was permitted to be connected to a route using a set of ``view*``
610   parameters passed to the ``add_route`` method of the Configurator.  This
611   was a shorthand which replaced the need to perform a subsequent call to
612   ``add_view``. For example, it was valid (and often recommended) to do::
613
614      config.add_route('home', '/', view='mypackage.views.myview',
615                        view_renderer='some/renderer.pt')
616
bf8c8f 617   Passing ``view*`` arguments to ``add_route`` is now deprecated in favor of
CM 618   connecting a view to a predefined route via ``Configurator.add_view`` using
619   the route's ``route_name`` parameter.  As a result, the above example
ed7ffe 620   should now be spelled::
CM 621
f426e5 622      config.add_route('home', '/')
CM 623      config.add_view('mypackage.views.myview', route_name='home')
624                      renderer='some/renderer.pt')
625
626   This deprecation was done to reduce confusion observed in IRC, as well as
627   to (eventually) reduce documentation burden (see also
628   https://github.com/Pylons/pyramid/issues/164).  A deprecation warning is
629   now issued when any view-related parameter is passed to
630   ``Configurator.add_route``.
631
632 - Passing an ``environ`` dictionary to the ``__call__`` method of a
633   "traverser" (e.g. an object that implements
634   ``pyramid.interfaces.ITraverser`` such as an instance of
635   ``pyramid.traversal.ResourceTreeTraverser``) as its ``request`` argument
636   now causes a deprecation warning to be emitted.  Consumer code should pass a
637   ``request`` object instead.  The fact that passing an environ dict is
638   permitted has been documentation-deprecated since ``repoze.bfg`` 1.1, and
639   this capability will be removed entirely in a future version.
640
641 - The following (undocumented, dictionary-like) methods of the
4d9260 642   ``pyramid.request.Request`` object have been deprecated: ``__contains__``,
CM 643   ``__delitem__``, ``__getitem__``, ``__iter__``, ``__setitem__``, ``get``,
644   ``has_key``, ``items``, ``iteritems``, ``itervalues``, ``keys``, ``pop``,
645   ``popitem``, ``setdefault``, ``update``, and ``values``.  Usage of any of
646   these methods will cause a deprecation warning to be emitted.  These
647   methods were added for internal compatibility in ``repoze.bfg`` 1.1 (code
648   that currently expects a request object expected an environ object in BFG
649   1.0 and before).  In a future version, these methods will be removed
650   entirely.
651
920990 652 - Deprecated ``pyramid.view.is_response`` function in favor of (newly-added)
CM 653   ``pyramid.request.Request.is_response`` method.  Determining if an object
654   is truly a valid response object now requires access to the registry, which
655   is only easily available as a request attribute.  The
656   ``pyramid.view.is_response`` function will still work until it is removed,
657   but now may return an incorrect answer under some (very uncommon)
658   circumstances.
659
4d9260 660 Behavior Changes
CM 661 ----------------
662
18b25a 663 - The default Mako renderer is now configured to escape all HTML in
MM 664   expression tags. This is intended to help prevent XSS attacks caused by
665   rendering unsanitized input from users. To revert this behavior in user's
666   templates, they need to filter the expression through the 'n' filter.
667   For example, ${ myhtml | n }.
668   See https://github.com/Pylons/pyramid/issues/193.
669
99edc5 670 - A custom request factory is now required to return a request object that
4d9260 671   has a ``response`` attribute (or "reified"/lazy property) if they the
CM 672   request is meant to be used in a view that uses a renderer.  This
673   ``response`` attribute should be an instance of the class
674   ``pyramid.response.Response``.
675
676 - The JSON and string renderer factories now assign to
677   ``request.response.content_type`` rather than
bf7544 678   ``request.response_content_type``.
CM 679
680 - Each built-in renderer factory now determines whether it should change the
681   content type of the response by comparing the response's content type
682   against the response's default content type; if the content type is the
683   default content type (usually ``text/html``), the renderer changes the
684   content type (to ``application/json`` or ``text/plain`` for JSON and string
685   renderers respectively).
4d9260 686
ba0a5f 687 - The ``pyramid.wsgi.wsgiapp2`` now uses a slightly different method of
CM 688   figuring out how to "fix" ``SCRIPT_NAME`` and ``PATH_INFO`` for the
689   downstream application.  As a result, those values may differ slightly from
690   the perspective of the downstream application (for example, ``SCRIPT_NAME``
691   will now never possess a trailing slash).
692
bca03f 693 - Previously, ``pyramid.request.Request`` inherited from
CM 694   ``webob.request.Request`` and implemented ``__getattr__``, ``__setattr__``
695   and ``__delattr__`` itself in order to overidde "adhoc attr" WebOb behavior
696   where attributes of the request are stored in the environ.  Now,
697   ``pyramid.request.Request`` object inherits from (the more recent)
698   ``webob.request.BaseRequest`` instead of ``webob.request.Request``, which
699   provides the same behavior.  ``pyramid.request.Request`` no longer
700   implements its own ``__getattr__``, ``__setattr__`` or ``__delattr__`` as a
701   result.
702
966b5c 703 - ``pyramid.response.Response`` is now a *subclass* of
99edc5 704   ``webob.response.Response`` (in order to directly implement the
CM 705   ``pyramid.interfaces.IResponse`` interface).
706
53d11e 707 - The "exception response" objects importable from ``pyramid.httpexceptions``
CM 708   (e.g. ``HTTPNotFound``) are no longer just import aliases for classes that
709   actually live in ``webob.exc``.  Instead, we've defined our own exception
710   classes within the module that mirror and emulate the ``webob.exc``
1e5e31 711   exception response objects almost entirely.  See the "Design Defense" doc
CM 712   section named "Pyramid Uses its Own HTTP Exception Classes" for more
713   information.
53d11e 714
d868ff 715 Backwards Incompatibilities
CM 716 ---------------------------
99edc5 717
5484e3 718 - Pyramid no longer supports Python 2.4.  Python 2.5 or better is required to
CM 719   run Pyramid 1.1+.
720
99edc5 721 - The Pyramid router now, by default, expects response objects returned from
d868ff 722   view callables to implement the ``pyramid.interfaces.IResponse`` interface.
CM 723   Unlike the Pyramid 1.0 version of this interface, objects which implement
724   IResponse now must define a ``__call__`` method that accepts ``environ``
725   and ``start_response``, and which returns an ``app_iter`` iterable, among
726   other things.  Previously, it was possible to return any object which had
727   the three WebOb ``app_iter``, ``headerlist``, and ``status`` attributes as
728   a response, so this is a backwards incompatibility.  It is possible to get
729   backwards compatibility back by registering an adapter to IResponse from
730   the type of object you're now returning from view callables.  See the
731   section in the Hooks chapter of the documentation entitled "Changing How
732   Pyramid Treats View Responses".
733
734 - The ``pyramid.interfaces.IResponse`` interface is now much more extensive.
735   Previously it defined only ``app_iter``, ``status`` and ``headerlist``; now
736   it is basically intended to directly mirror the ``webob.Response`` API,
737   which has many methods and attributes.
966b5c 738
d0a5f0 739 - The ``pyramid.httpexceptions`` classes named ``HTTPFound``,
CM 740   ``HTTPMultipleChoices``, ``HTTPMovedPermanently``, ``HTTPSeeOther``,
741   ``HTTPUseProxy``, and ``HTTPTemporaryRedirect`` now accept ``location`` as
742   their first positional argument rather than ``detail``.  This means that
743   you can do, e.g. ``return pyramid.httpexceptions.HTTPFound('http://foo')``
744   rather than ``return
745   pyramid.httpexceptions.HTTPFound(location='http//foo')`` (the latter will
746   of course continue to work).
747
0f7831 748 Dependencies
CM 749 ------------
750
dad904 751 - Pyramid now depends on WebOb >= 1.0.2 as tests depend on the bugfix in that
CM 752   release: "Fix handling of WSGI environs with missing ``SCRIPT_NAME``".
0f7831 753   (Note that in reality, everyone should probably be using 1.0.4 or better
CM 754   though, as WebOb 1.0.2 and 1.0.3 were effectively brownbag releases.)
755