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