From 1ffb8e3cc21603b29ccd78152f82cca7f61a09b1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 16 May 2011 02:11:56 -0400 Subject: - Added API docs for ``pyramid.httpexceptions.abort`` and ``pyramid.httpexceptions.redirect``. - Added "HTTP Exceptions" section to Views narrative chapter including a description of ``pyramid.httpexceptions.abort``; adjusted redirect section to note ``pyramid.httpexceptions.redirect``. - A default exception view for the context ``webob.exc.HTTPException`` (aka ``pyramid.httpexceptions.HTTPException``) is now registered by default. This means that an instance of any exception class imported from ``pyramid.httpexceptions`` (such as ``HTTPFound``) can now be raised from within view code; when raised, this exception view will render the exception to a response. - New functions named ``pyramid.httpexceptions.abort`` and ``pyramid.httpexceptions.redirect`` perform the equivalent of their Pylons brethren when an HTTP exception handler is registered. These functions take advantage of the newly registered exception view for ``webob.exc.HTTPException``. - The Configurator now accepts an additional keyword argument named ``httpexception_view``. By default, this argument is populated with a default exception view function that will be used when an HTTP exception is raised. When ``None`` is passed for this value, an exception view for HTTP exceptions will not be registered. Passing ``None`` returns the behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception will propagate to middleware and to the WSGI server). --- docs/whatsnew-1.1.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 992e0b637..488328519 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -18,6 +18,9 @@ The major feature additions in Pyramid 1.1 are: - Support for "static" routes. +- Default HTTP exception view and associated ``redirect`` and ``abort`` + convenience functions. + ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -50,6 +53,31 @@ Static Routes be useful for URL generation via ``route_url`` and ``route_path``. See the section entitled :ref:`static_route_narr` for more information. +Default HTTP Exception View +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- A default exception view for the context :exc:`webob.exc.HTTPException` + (aka :class:`pyramid.httpexceptions.HTTPException`) is now registered by + default. This means that an instance of any exception class imported from + :mod:`pyramid.httpexceptions` (such as ``HTTPFound``) can now be raised + from within view code; when raised, this exception view will render the + exception to a response. + + New convenience functions named :func:`pyramid.httpexceptions.abort` and + :func:`pyramid.httpexceptions.redirect` perform the equivalent of their + Pylons brethren when an HTTP exception handler is registered. These + functions take advantage of the newly registered exception view for + :exc:`webob.exc.HTTPException`. + + To allow for configuration of this feature, the :term:`Configurator` now + accepts an additional keyword argument named ``httpexception_view``. By + default, this argument is populated with a default exception view function + that will be used when an HTTP exception is raised. When ``None`` is + passed for this value, an exception view for HTTP exceptions will not be + registered. Passing ``None`` returns the behavior of raising an HTTP + exception to that of Pyramid 1.0 (the exception will propagate to + middleware and to the WSGI server). + Minor Feature Additions ----------------------- @@ -222,3 +250,10 @@ Documentation Enhancements - Added a section to the "URL Dispatch" narrative chapter regarding the new "static" route feature entitled :ref:`static_route_narr`. + +- Added API docs for :func:`pyramid.httpexceptions.abort` and + :func:`pyramid.httpexceptions.redirect`. + +- Added :ref:`http_exceptions` section to Views narrative chapter including a + description of :func:`pyramid.httpexceptions.abort`` and + :func:`pyramid.httpexceptions.redirect`. -- cgit v1.2.3 From 99edc51a3b05309c7f5d98ff96289ec51b1d7660 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 11 Jun 2011 05:35:27 -0400 Subject: - Pyramid now expects Response objects to have a __call__ method which implements the WSGI application interface instead of the three webob attrs status, headerlist and app_iter. Backwards compatibility exists for code which returns response objects that do not have a __call__. - pyramid.response.Response is no longer an exception (and therefore cannot be raised in order to generate a response). - Changed my mind about moving stuff from pyramid.httpexceptions to pyramid.response. The stuff I moved over has been moved back to pyramid.httpexceptions. --- docs/whatsnew-1.1.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 488328519..533ae3637 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -63,12 +63,6 @@ Default HTTP Exception View from within view code; when raised, this exception view will render the exception to a response. - New convenience functions named :func:`pyramid.httpexceptions.abort` and - :func:`pyramid.httpexceptions.redirect` perform the equivalent of their - Pylons brethren when an HTTP exception handler is registered. These - functions take advantage of the newly registered exception view for - :exc:`webob.exc.HTTPException`. - To allow for configuration of this feature, the :term:`Configurator` now accepts an additional keyword argument named ``httpexception_view``. By default, this argument is populated with a default exception view function @@ -81,6 +75,10 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- A function named :func:`pyramid.httpexceptions.responsecode` is a shortcut + that can be used to create HTTP exception response objects using an HTTP + integer status code. + - Integers and longs passed as ``elements`` to :func:`pyramid.url.resource_url` or :meth:`pyramid.request.Request.resource_url` e.g. ``resource_url(context, @@ -177,7 +175,7 @@ Deprecations and Behavior Differences expected an environ object in BFG 1.0 and before). In a future version, these methods will be removed entirely. -- A custom request factory is now required to return a response object that +- A custom request factory is now required to return a request object that has a ``response`` attribute (or "reified"/lazy property) if they the request is meant to be used in a view that uses a renderer. This ``response`` attribute should be an instance of the class -- cgit v1.2.3 From f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Jun 2011 00:57:30 -0400 Subject: responsecode -> exception_response --- docs/whatsnew-1.1.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 172a20343..cee701b49 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -18,8 +18,7 @@ The major feature additions in Pyramid 1.1 are: - Support for "static" routes. -- Default HTTP exception view and associated ``redirect`` and ``abort`` - convenience functions. +- Default HTTP exception view. ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -56,8 +55,8 @@ Static Routes Default HTTP Exception View ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- A default exception view for the context :exc:`webob.exc.HTTPException` - (aka :class:`pyramid.httpexceptions.HTTPException`) is now registered by +- A default exception view for the context + :class:`pyramid.interfaces.IExceptionResponse` is now registered by default. This means that an instance of any exception class imported from :mod:`pyramid.httpexceptions` (such as ``HTTPFound``) can now be raised from within view code; when raised, this exception view will render the @@ -79,9 +78,9 @@ Minor Feature Additions :class:`pyramid.authentication.SessionAuthenticationPolicy`, which uses a session to store credentials. -- A function named :func:`pyramid.httpexceptions.responsecode` is a shortcut - that can be used to create HTTP exception response objects using an HTTP - integer status code. +- A function named :func:`pyramid.httpexceptions.exception_response` is a + shortcut that can be used to create HTTP exception response objects using + an HTTP integer status code. - Integers and longs passed as ``elements`` to :func:`pyramid.url.resource_url` or -- cgit v1.2.3 From 8cbbd98daa3ef4f43cfc46359c4e5bae85b1185c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Jun 2011 01:19:18 -0400 Subject: bring whatsnew up to date --- docs/whatsnew-1.1.rst | 110 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 101 insertions(+), 9 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index cee701b49..07114f5d1 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -55,7 +55,7 @@ Static Routes Default HTTP Exception View ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- A default exception view for the context +- A default exception view for the interface :class:`pyramid.interfaces.IExceptionResponse` is now registered by default. This means that an instance of any exception class imported from :mod:`pyramid.httpexceptions` (such as ``HTTPFound``) can now be raised @@ -63,10 +63,10 @@ Default HTTP Exception View exception to a response. To allow for configuration of this feature, the :term:`Configurator` now - accepts an additional keyword argument named ``httpexception_view``. By - default, this argument is populated with a default exception view function - that will be used when an HTTP exception is raised. When ``None`` is - passed for this value, an exception view for HTTP exceptions will not be + accepts an additional keyword argument named ``exceptionresponse_view``. + By default, this argument is populated with a default exception view + function that will be used when an HTTP exception is raised. When ``None`` + is passed for this value, an exception view for HTTP exceptions will not be registered. Passing ``None`` returns the behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception will propagate to middleware and to the WSGI server). @@ -116,6 +116,69 @@ Minor Feature Additions although typically nonsensical). Allowing the nonsensical configuration made the code more understandable and required fewer tests. +- The :class:`pyramid.request.Request` class now has a ``ResponseClass`` + attribute which points at :class:`pyramid.response.Response`. + +- The :class:`pyramid.response.Response` class now has a ``RequestClass`` + interface which points at :class:`pyramid.request.Request`. + +- It is now possible to return an arbitrary object from a Pyramid view + callable even if a renderer is not used, as long as a suitable adapter to + :class:`pyramid.interfaces.IResponse` is registered for the type of the + returned object by using the new + :meth:`pyramid.config.Configurator.add_response_adapter` API. See the + section in the Hooks chapter of the documentation entitled + :ref:`using_iresponse`. + +- The Pyramid router will now, by default, call the ``__call__`` method of + response objects when returning a WSGI response. This means that, among + other things, the ``conditional_response`` feature response objects + inherited from WebOb will now behave properly. + +- New method named :meth:`pyramid.request.Request.is_response`. This method + should be used instead of the :func:`pyramid.view.is_response` function, + which has been deprecated. + +- :class:`pyramid.exceptions.NotFound` is now just an alias for + :class:`pyramid.httpexceptions.HTTPNotFound`. + +- :class:`pyramid.exceptions.NotFound` is now just an alias for + :class:`pyramid.httpexceptions.HTTPNotFound`. + +Backwards Incompatibilities +--------------------------- + +- Pyramid no longer supports Python 2.4. Python 2.5 or better is required to + run Pyramid 1.1+. Pyramid, however, does not work under any version of + Python 3 yet. + +- The Pyramid router now, by default, expects response objects returned from + view callables to implement the :class:`pyramid.interfaces.IResponse` + interface. Unlike the Pyramid 1.0 version of this interface, objects which + implement IResponse now must define a ``__call__`` method that accepts + ``environ`` and ``start_response``, and which returns an ``app_iter`` + iterable, among other things. Previously, it was possible to return any + object which had the three WebOb ``app_iter``, ``headerlist``, and + ``status`` attributes as a response, so this is a backwards + incompatibility. It is possible to get backwards compatibility back by + registering an adapter to IResponse from the type of object you're now + returning from view callables. See the section in the Hooks chapter of the + documentation entitled :ref:`using_iresponse`. + +- The :class:`pyramid.interfaces.IResponse` interface is now much more + extensive. Previously it defined only ``app_iter``, ``status`` and + ``headerlist``; now it is basically intended to directly mirror the + ``webob.Response`` API, which has many methods and attributes. + +- The :mod:`pyramid.httpexceptions` classes named ``HTTPFound``, + ``HTTPMultipleChoices``, ``HTTPMovedPermanently``, ``HTTPSeeOther``, + ``HTTPUseProxy``, and ``HTTPTemporaryRedirect`` now accept ``location`` as + their first positional argument rather than ``detail``. This means that + you can do, e.g. ``return pyramid.httpexceptions.HTTPFound('http://foo')`` + rather than ``return + pyramid.httpexceptions.HTTPFound(location='http//foo')`` (the latter will + of course continue to work). + Deprecations and Behavior Differences ------------------------------------- @@ -218,6 +281,34 @@ Deprecations and Behavior Differences :class:`pyramid.request.Request` no longer implements its own ``__getattr__``, ``__setattr__`` or ``__delattr__`` as a result. +- Deprecated :func:`pyramid.view.is_response` function in favor of + (newly-added) :meth:`pyramid.request.Request.is_response` method. + Determining if an object is truly a valid response object now requires + access to the registry, which is only easily available as a request + attribute. The :func:`pyramid.view.is_response` function will still work + until it is removed, but now may return an incorrect answer under some + (very uncommon) circumstances. + +- :class:`pyramid.response.Response` is now a *subclass* of + ``webob.response.Response`` (in order to directly implement the + :class:`pyramid.interfaces.IResponse` interface, to speed up response + generation). + +- The "exception response" objects importable from ``pyramid.httpexceptions`` + (e.g. ``HTTPNotFound``) are no longer just import aliases for classes that + actually live in ``webob.exc``. Instead, we've defined our own exception + classes within the module that mirror and emulate the ``webob.exc`` + exception response objects almost entirely. See + :ref:`http_exception_hierarchy` in the Design Defense chapter for more + information. + +- When visiting a URL that represented a static view which resolved to a + subdirectory, the ``index.html`` of that subdirectory would not be served + properly. Instead, a redirect to ``/subdir`` would be issued. This has + been fixed, and now visiting a subdirectory that contains an ``index.html`` + within a static view returns the index.html properly. See also + https://github.com/Pylons/pyramid/issues/67. + Dependency Changes ------------------ @@ -261,9 +352,10 @@ Documentation Enhancements - Added a section to the "URL Dispatch" narrative chapter regarding the new "static" route feature entitled :ref:`static_route_narr`. -- Added API docs for :func:`pyramid.httpexceptions.abort` and - :func:`pyramid.httpexceptions.redirect`. +- Added API docs for :func:`pyramid.httpexceptions.exception_response`. - Added :ref:`http_exceptions` section to Views narrative chapter including a - description of :func:`pyramid.httpexceptions.abort`` and - :func:`pyramid.httpexceptions.redirect`. + description of :func:`pyramid.httpexceptions.exception_response`. + +- Added API docs for + :class:`pyramid.authentication.SessionAuthenticationPolicy`. -- cgit v1.2.3 From 032e777b50c2565d64a995bf8abbfa332784d855 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Jun 2011 01:19:41 -0400 Subject: bring whatsnew up to date --- docs/whatsnew-1.1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 07114f5d1..f5a8f88a4 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -142,8 +142,8 @@ Minor Feature Additions - :class:`pyramid.exceptions.NotFound` is now just an alias for :class:`pyramid.httpexceptions.HTTPNotFound`. -- :class:`pyramid.exceptions.NotFound` is now just an alias for - :class:`pyramid.httpexceptions.HTTPNotFound`. +- :class:`pyramid.exceptions.Forbidden` is now just an alias for + :class:`pyramid.httpexceptions.HTTPForbidden`. Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From 837c257c60942bdb8f1a71a1a12faf8afe1a71d5 Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Mon, 20 Jun 2011 07:42:41 -0700 Subject: Removed superfluous word --- docs/whatsnew-1.1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index f5a8f88a4..1638fe9db 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -40,8 +40,8 @@ The major feature additions in Pyramid 1.1 are: - A new paster command named ``paster pviews`` was added. This command prints a summary of potentially matching views for a given path. See - documentation the section entitled :ref:`displaying_matching_views` for - more information. + the section entitled :ref:`displaying_matching_views` for more + information. Static Routes ~~~~~~~~~~~~~ -- cgit v1.2.3 From 92cf3d14c15c0461953000719aafab83ae991f6d Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Mon, 20 Jun 2011 08:05:06 -0700 Subject: typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 1638fe9db..681f05699 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -273,7 +273,7 @@ Deprecations and Behavior Differences - Previously, :class:`pyramid.request.Request` inherited from :class:`webob.request.Request` and implemented ``__getattr__``, - ``__setattr__`` and ``__delattr__`` itself in order to overidde "adhoc + ``__setattr__`` and ``__delattr__`` itself in order to override "adhoc attr" WebOb behavior where attributes of the request are stored in the environ. Now, :class:`pyramid.request.Request inherits from (the more recent) :class:`webob.request.BaseRequest`` instead of -- cgit v1.2.3 From 654e3da9d426cdb70426f1eb2a0fce0181934b41 Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Mon, 20 Jun 2011 08:08:08 -0700 Subject: corrected missing apostrophe and then extra apostrophe --- docs/whatsnew-1.1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 681f05699..b57657d11 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -275,8 +275,8 @@ Deprecations and Behavior Differences :class:`webob.request.Request` and implemented ``__getattr__``, ``__setattr__`` and ``__delattr__`` itself in order to override "adhoc attr" WebOb behavior where attributes of the request are stored in the - environ. Now, :class:`pyramid.request.Request inherits from (the more - recent) :class:`webob.request.BaseRequest`` instead of + environ. Now, :class:`pyramid.request.Request` inherits from (the more + recent) :class:`webob.request.BaseRequest` instead of :class:`webob.request.Request`, which provides the same behavior. :class:`pyramid.request.Request` no longer implements its own ``__getattr__``, ``__setattr__`` or ``__delattr__`` as a result. -- cgit v1.2.3 From fc950d607e942dd6ae755354a8ac0d30040a5848 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 21 Jun 2011 19:44:34 -0400 Subject: changes suggested by sluggo --- docs/whatsnew-1.1.rst | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index b57657d11..7c2aad821 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -7,6 +7,15 @@ incompatibilities between the two versions and deprecations added to Pyramid 1.1, as well as software dependency changes and notable documentation additions. +Terminology Changes +------------------- + +The term "template" used by the Pyramid documentation used to refer to both +"paster templates" and "rendered templates" (templates created by a rendering +engine. i.e. Mako, Chameleon, Jinja, etc.). "Paster templates" will now be +refered to as "scaffolds", whereas the name for "rendered templates" will +remain as "templates." + Major Feature Additions ----------------------- @@ -23,17 +32,28 @@ The major feature additions in Pyramid 1.1 are: ``request.response`` ~~~~~~~~~~~~~~~~~~~~ -- Accessing the ``response`` attribute of a :class:`pyramid.request.Request` - object (e.g. ``request.response`` within a view) now produces a new - :class:`pyramid.response.Response` object. This feature is meant to be - used mainly when a view configured with a renderer needs to set response - attributes: all renderers will use the Response object implied by - ``request.response`` as the response object returned to the router. - - ``request.response`` can also be used by code in a view that does not use a - renderer, however the response object that is produced by - ``request.response`` must be returned when a renderer is not in play (it is - not a "global" response). +- Instances of the :class:`pyramid.request.Request` class now have a + ``response`` attribute. + + The object passed to a view callable as ``request`` is an instance of + :class:`pyramid.request.Request`. ``request.response`` is an instance of + the class :class:`pyramid.request.Response`. View callables that are + configured with a :term:`renderer` will return this response object to the + Pyramid router. Therefore, code in a renderer-using view callable can set + response attributes such as ``request.response.content_type`` (before they + return, e.g. a dictionary to the renderer) and this will influence the HTTP + return value of the view callable. + + ``request.response`` can also be used in view callable code that is not + configured to use a renderer. For example, a view callable might do + ``request.response.body = '123'; return request.response``. However, the + response object that is produced by ``request.response`` must be *returned* + when a renderer is not in play in order to have any effect on the HTTP + response (it is not a "global" response, and modifications to it are not + somehow merged into a separately returned response object). + + The ``request.response`` object is lazily created, so its introduction does + not negatively impact performance. ``paster pviews`` ~~~~~~~~~~~~~~~~~ @@ -321,11 +341,6 @@ Dependency Changes Documentation Enhancements -------------------------- -- The term "template" used to refer to both "paster templates" and "rendered - templates" (templates created by a rendering engine. i.e. Mako, Chameleon, - Jinja, etc.). "Paster templates" will now be refered to as "scaffolds", - whereas the name for "rendered templates" will remain as "templates." - - The :ref:`bfg_wiki_tutorial` was updated slightly. - The :ref:`bfg_sql_wiki_tutorial` was updated slightly. -- cgit v1.2.3 From 40369d7f54adb84aa7c4e56498b18b6dda75938a Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Tue, 21 Jun 2011 18:07:25 -0700 Subject: fix typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 7c2aad821..cf8086fbe 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -241,7 +241,7 @@ Deprecations and Behavior Differences spelled:: config.add_route('home', '/') - config.add_view('mypackage.views.myview', route_name='home') + config.add_view('mypackage.views.myview', route_name='home', renderer='some/renderer.pt') This deprecation was done to reduce confusion observed in IRC, as well as -- cgit v1.2.3 From bf7544c683803c4490e7c82e25e31d36261fb973 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 22 Jun 2011 00:29:36 -0400 Subject: suggestions from sluggo --- docs/whatsnew-1.1.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 7c2aad821..66f398e27 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -278,12 +278,14 @@ Deprecations and Behavior Differences - The JSON and string renderer factories now assign to ``request.response.content_type`` rather than - ``request.response_content_type``. Each renderer factory determines - whether it should change the content type of the response by comparing the - response's content type against the response's default content type; if the - content type is not the default content type (usually ``text/html``), the - renderer changes the content type (to ``application/json`` or - ``text/plain`` for JSON and string renderers respectively). + ``request.response_content_type``. + +- Each built-in renderer factory now determines whether it should change the + content type of the response by comparing the response's content type + against the response's default content type; if the content type is the + default content type (usually ``text/html``), the renderer changes the + content type (to ``application/json`` or ``text/plain`` for JSON and string + renderers respectively). - The :func:`pyramid.wsgi.wsgiapp2` now uses a slightly different method of figuring out how to "fix" ``SCRIPT_NAME`` and ``PATH_INFO`` for the -- cgit v1.2.3 From cc85e7a96ccbb1671514adb1a1b1992fd1f02461 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 22 Jun 2011 19:39:45 -0400 Subject: prep for 1.1a2 --- docs/whatsnew-1.1.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index faf8b8b68..180380608 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -199,6 +199,32 @@ Backwards Incompatibilities pyramid.httpexceptions.HTTPFound(location='http//foo')`` (the latter will of course continue to work). +- The pyramid Router attempted to set a value into the key + ``environ['repoze.bfg.message']`` when it caught a view-related exception + for backwards compatibility with applications written for :mod:`repoze.bfg` + during error handling. It did this by using code that looked like so:: + + # "why" is an exception object + try: + msg = why[0] + except: + msg = '' + + environ['repoze.bfg.message'] = msg + + Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in + Pyramid 1.0. Our standing policy is to not remove features after a + deprecation for two full major releases, so this code was originally slated + to be removed in Pyramid 1.2. However, computing the + ``repoze.bfg.message`` value was the source of at least one bug found in + the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a + foolproof way to both preserve backwards compatibility and to fix the bug. + Therefore, the code which sets the value has been removed in this release. + Code in exception views which relies on this value's presence in the + environment should now use the ``exception`` attribute of the request + (e.g. ``request.exception[0]``) to retrieve the message instead of relying + on ``request.environ['repoze.bfg.message']``. + Deprecations and Behavior Differences ------------------------------------- -- cgit v1.2.3 From 8bd6cf291b91977f22d8e153328cc13d38d00ff2 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 26 Jun 2011 03:46:47 -0400 Subject: - Added ``mako.preprocessor`` config file parameter; allows for a Mako preprocessor to be specified as a Python callable or Python dotted name. See https://github.com/Pylons/pyramid/pull/183 for rationale. Closes #183. --- docs/whatsnew-1.1.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 180380608..4d7567886 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -165,6 +165,10 @@ Minor Feature Additions - :class:`pyramid.exceptions.Forbidden` is now just an alias for :class:`pyramid.httpexceptions.HTTPForbidden`. +- Added ``mako.preprocessor`` config file parameter; allows for a Mako + preprocessor to be specified as a Python callable or Python dotted name. + See https://github.com/Pylons/pyramid/pull/183 for rationale. + Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From c1f3d0fd89eb7f62a7de365ca5c0ef5600ffd900 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 00:59:11 -0400 Subject: Add JSONP renderer --- docs/whatsnew-1.1.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 4d7567886..9895858cd 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,9 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- A `JSONP `_ renderer. See + :ref:`jsonp_renderer` for more details. + - New authentication policy: :class:`pyramid.authentication.SessionAuthenticationPolicy`, which uses a session to store credentials. -- cgit v1.2.3 From 6579f51fec8506332cdd61d06ed20178f0bdfbcb Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 01:02:55 -0400 Subject: typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 9895858cd..7d0f666d3 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -95,7 +95,7 @@ Minor Feature Additions ----------------------- - A `JSONP `_ renderer. See - :ref:`jsonp_renderer` for more details. + :ref:`jsonp_renderer` for more details. - New authentication policy: :class:`pyramid.authentication.SessionAuthenticationPolicy`, which uses a -- cgit v1.2.3 From b7f33b5fdd062e007723d0eb60001442f35c0bf7 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 01:24:39 -0400 Subject: - Deprecated the ``set_renderer_globals_factory`` method of the Configurator and the ``renderer_globals`` Configurator constructor parameter. --- docs/whatsnew-1.1.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 7d0f666d3..3252cba22 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -364,6 +364,12 @@ Deprecations and Behavior Differences within a static view returns the index.html properly. See also https://github.com/Pylons/pyramid/issues/67. +- Deprecated the + :meth:`pyramid.config.Configurator.set_renderer_globals_factory` method and + the ``renderer_globals`` Configurator constructor parameter. Users should + use convert code using this feature to use a BeforeRender event als + :ref:`beforerender_event`. + Dependency Changes ------------------ -- cgit v1.2.3 From 8519c9a97dfdc4be7e4ba76e6e175ec9e7668b78 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 03:20:34 -0400 Subject: fix --- docs/whatsnew-1.1.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 3252cba22..d83582dee 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -370,6 +370,29 @@ Deprecations and Behavior Differences use convert code using this feature to use a BeforeRender event als :ref:`beforerender_event`. +- In Pyramid 1.0, the :class:`pyramid.events.subscriber` directive behaved + contrary to the documentation when passed more than one interface object to + its constructor. For example, when the following listener was registered:: + + @subscriber(IFoo, IBar) + def expects_ifoo_events_and_ibar_events(event): + print event + + The Events chapter docs claimed that the listener would be registered and + listening for both ``IFoo`` and ``IBar`` events. Instead, it registered an + "object event" subscriber which would only be called if an IObjectEvent was + emitted where the object interface was ``IFoo`` and the event interface was + ``IBar``. + + The behavior now matches the documentation. If you were relying on the + buggy behavior of the 1.0 ``subscriber`` directive in order to register an + object event subscriber, you must now pass a sequence to indicate you'd + like to register a subscriber for an object event. e.g.:: + + @subscriber([IFoo, IBar]) + def expects_object_event(object, event): + print object, event + Dependency Changes ------------------ -- cgit v1.2.3 From 0fa1993d2abe87e197374f6abd3e45e62afb8a19 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 4 Jul 2011 01:07:45 -0400 Subject: - A new value ``http_cache`` can be used as a view configuration parameter. When you supply an ``http_cache`` value to a view configuration, the ``Expires`` and ``Cache-Control`` headers of a response generated by the associated view callable are modified. The value for ``http_cache`` may be one of the following: - A nonzero integer. If it's a nonzero integer, it's treated as a number of seconds. This number of seconds will be used to compute the ``Expires`` header and the ``Cache-Control: max-age`` parameter of responses to requests which call this view. For example: ``http_cache=3600`` instructs the requesting browser to 'cache this response for an hour, please'. - A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` instance, it will be converted into a number of seconds, and that number of seconds will be used to compute the ``Expires`` header and the ``Cache-Control: max-age`` parameter of responses to requests which call this view. For example: ``http_cache=datetime.timedelta(days=1)`` instructs the requesting browser to 'cache this response for a day, please'. - Zero (``0``). If the value is zero, the ``Cache-Control`` and ``Expires`` headers present in all responses from this view will be composed such that client browser cache (and any intermediate caches) are instructed to never cache the response. - A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, {'public':True})``), the first value in the tuple may be a nonzero integer or a ``datetime.timedelta`` instance; in either case this value will be used as the number of seconds to cache the response. The second value in the tuple must be a dictionary. The values present in the dictionary will be used as input to the ``Cache-Control`` response header. For example: ``http_cache=(3600, {'public':True})`` means 'cache for an hour, and add ``public`` to the Cache-Control header of the response'. All keys and values supported by the ``webob.cachecontrol.CacheControl`` interface may be added to the dictionary. Supplying ``{'public':True}`` is equivalent to calling ``response.cache_control.public = True``. Providing a non-tuple value as ``http_cache`` is equivalent to calling ``response.cache_expires(value)`` within your view's body. Providing a two-tuple value as ``http_cache`` is equivalent to calling ``response.cache_expires(value[0], **value[1])`` within your view's body. If you wish to avoid influencing, the ``Expires`` header, and instead wish to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` with the first element of ``None``, e.g.: ``(None, {'public':True})``. --- docs/whatsnew-1.1.rst | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index d83582dee..783f2caaa 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,57 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- A new value ``http_cache`` can be used as a :term:`view configuration` + parameter. + + When you supply an ``http_cache`` value to a view configuration, the + ``Expires`` and ``Cache-Control`` headers of a response generated by the + associated view callable are modified. The value for ``http_cache`` may be + one of the following: + + - A nonzero integer. If it's a nonzero integer, it's treated as a number + of seconds. This number of seconds will be used to compute the + ``Expires`` header and the ``Cache-Control: max-age`` parameter of + responses to requests which call this view. For example: + ``http_cache=3600`` instructs the requesting browser to 'cache this + response for an hour, please'. + + - A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` + instance, it will be converted into a number of seconds, and that number + of seconds will be used to compute the ``Expires`` header and the + ``Cache-Control: max-age`` parameter of responses to requests which call + this view. For example: ``http_cache=datetime.timedelta(days=1)`` + instructs the requesting browser to 'cache this response for a day, + please'. + + - Zero (``0``). If the value is zero, the ``Cache-Control`` and + ``Expires`` headers present in all responses from this view will be + composed such that client browser cache (and any intermediate caches) are + instructed to never cache the response. + + - A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, + {'public':True})``), the first value in the tuple may be a nonzero + integer or a ``datetime.timedelta`` instance; in either case this value + will be used as the number of seconds to cache the response. The second + value in the tuple must be a dictionary. The values present in the + dictionary will be used as input to the ``Cache-Control`` response + header. For example: ``http_cache=(3600, {'public':True})`` means 'cache + for an hour, and add ``public`` to the Cache-Control header of the + response'. All keys and values supported by the + ``webob.cachecontrol.CacheControl`` interface may be added to the + dictionary. Supplying ``{'public':True}`` is equivalent to calling + ``response.cache_control.public = True``. + + Providing a non-tuple value as ``http_cache`` is equivalent to calling + ``response.cache_expires(value)`` within your view's body. + + Providing a two-tuple value as ``http_cache`` is equivalent to calling + ``response.cache_expires(value[0], **value[1])`` within your view's body. + + If you wish to avoid influencing, the ``Expires`` header, and instead wish + to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` + with the first element of ``None``, e.g.: ``(None, {'public':True})``. + - A `JSONP `_ renderer. See :ref:`jsonp_renderer` for more details. -- cgit v1.2.3 From b78effb723e5a6b2f3980dac7830f8932abd7890 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 4 Jul 2011 03:58:00 -0400 Subject: - New request attribute: ``json``. If the request's ``content_type`` is ``application/json``, this attribute will contain the JSON-decoded variant of the request body. If the request's ``content_type`` is not ``application/json``, this attribute will be ``None``. --- docs/whatsnew-1.1.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 783f2caaa..fdf3b1c74 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,11 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- New request attribute: ``json``. If the request's ``content_type`` is + ``application/json``, this attribute will contain the JSON-decoded + variant of the request body. If the request's ``content_type`` is not + ``application/json``, this attribute will be ``None``. + - A new value ``http_cache`` can be used as a :term:`view configuration` parameter. -- cgit v1.2.3 From fca1efe07ac46b2817f30299bbebbc2031cce339 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 6 Jul 2011 14:57:59 -0400 Subject: - The ``config.scan`` method has grown a ``**kw`` argument. ``kw`` argument represents a set of keyword arguments to pass to the Venusian ``Scanner`` object created by Pyramid. (See the Venusian documentation for more information about ``Scanner``). --- docs/whatsnew-1.1.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index fdf3b1c74..a6bb8e99d 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,11 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- The :meth:`pyramid.config.Configurator.scan` method has grown a ``**kw`` + argument. ``kw`` argument represents a set of keyword arguments to pass to + the Venusian ``Scanner`` object created by Pyramid. (See the + :term:`Venusian` documentation for more information about ``Scanner``). + - New request attribute: ``json``. If the request's ``content_type`` is ``application/json``, this attribute will contain the JSON-decoded variant of the request body. If the request's ``content_type`` is not -- cgit v1.2.3 From 6a0602b3ce4d2a6de9dca25d8e0d390796a79267 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 9 Jul 2011 21:12:06 -0400 Subject: request.json -> request.json_body; add some docs for json_body --- docs/whatsnew-1.1.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index a6bb8e99d..a9df38a45 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -99,10 +99,9 @@ Minor Feature Additions the Venusian ``Scanner`` object created by Pyramid. (See the :term:`Venusian` documentation for more information about ``Scanner``). -- New request attribute: ``json``. If the request's ``content_type`` is - ``application/json``, this attribute will contain the JSON-decoded - variant of the request body. If the request's ``content_type`` is not - ``application/json``, this attribute will be ``None``. +- New request property: ``json_body``. This property will return the + JSON-decoded variant of the request body. If the request body is not + well-formed JSON, this property will raise an exception. - A new value ``http_cache`` can be used as a :term:`view configuration` parameter. -- cgit v1.2.3 From 7565006cf1f3b929d9ea54256214f3a39385936a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 10 Jul 2011 00:30:30 -0400 Subject: add info to changes.txt and whatsnew about pshell changes; removed unused import and unwrap string --- docs/whatsnew-1.1.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index a9df38a45..b249b0ba7 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,19 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- It is now possible to invoke ``paster pshell`` even if the paste ini file + section name pointed to in its argument is not actually a Pyramid WSGI + application. The shell will work in a degraded mode, and will warn the + user. See "The Interactive Shell" in the "Creating a Pyramid Project" + narrative documentation section. + +- ``paster pshell`` now offers more built-in global variables by default + (including ``app`` and ``settings``). See :ref:`interactive_shell`. + +- It is now possible to add a ``[pshell]`` section to your application's .ini + configuration file, which influences the global names available to a pshell + session. See :ref:`extending_pshell`. + - The :meth:`pyramid.config.Configurator.scan` method has grown a ``**kw`` argument. ``kw`` argument represents a set of keyword arguments to pass to the Venusian ``Scanner`` object created by Pyramid. (See the @@ -295,6 +308,12 @@ Backwards Incompatibilities Deprecations and Behavior Differences ------------------------------------- +- The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands + now take a single argument in the form ``/path/to/config.ini#sectionname`` + rather than the previous 2-argument spelling ``/path/to/config.ini + sectionname``. ``#sectionname`` may be omitted, in which case ``#main`` is + assumed. + - The default Mako renderer is now configured to escape all HTML in expression tags. This is intended to help prevent XSS attacks caused by rendering unsanitized input from users. To revert this behavior in user's -- cgit v1.2.3 From 7cf06765c863ec73adccc73cefcf7630b2020f21 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 03:26:21 -0400 Subject: warn about warnings in 2.7+ --- docs/whatsnew-1.1.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index b249b0ba7..8cf6c715c 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -308,6 +308,15 @@ Backwards Incompatibilities Deprecations and Behavior Differences ------------------------------------- +.. note:: Under Python 2.7+, it's necessary to pass the Python interpreter + the correct warning flags to see deprecation warnings emitted by Pyramid + when porting your application from an older version of Pyramid. Use the + ``PYTHONWARNINGS`` environment variable with the value ``all`` in the + shell you use to invoke ``paster serve`` to see these warnings, e.g. on + UNIX, ``PYTHONWARNINGS=all bin/paster serve development.ini``. Python 2.5 + and 2.6 show deprecation warnings by default, so this is unecessary there. + All deprecation warnings are emitted to the console. + - The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands now take a single argument in the form ``/path/to/config.ini#sectionname`` rather than the previous 2-argument spelling ``/path/to/config.ini -- cgit v1.2.3 From 82efa44c0d8f4b18b4f341519f54ecad68b56364 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 03:52:42 -0400 Subject: - Previously, If a ``BeforeRender`` event subscriber added a value via the ``__setitem__`` or ``update`` methods of the event object with a key that already existed in the renderer globals dictionary, a ``KeyError`` was raised. With the deprecation of the "add_renderer_globals" feature of the configurator, there was no way to override an existing value in the renderer globals dictionary that already existed. Now, the event object will overwrite an older value that is already in the globals dictionary when its ``__setitem__`` or ``update`` is called (as well as the new ``setdefault`` method), just like a plain old dictionary. As a result, for maximum interoperability with other third-party subscribers, if you write an event subscriber meant to be used as a BeforeRender subscriber, your subscriber code will now need to (using ``.get`` or ``__contains__`` of the event object) ensure no value already exists in the renderer globals dictionary before setting an overriding value. --- docs/whatsnew-1.1.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 8cf6c715c..345cbfa30 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -481,6 +481,22 @@ Deprecations and Behavior Differences def expects_object_event(object, event): print object, event +- In 1.0, if a :class:`pyramid.events.BeforeRender` event subscriber added a + value via the ``__setitem__`` or ``update`` methods of the event object + with a key that already existed in the renderer globals dictionary, a + ``KeyError`` was raised. With the deprecation of the + "add_renderer_globals" feature of the configurator, there was no way to + override an existing value in the renderer globals dictionary that already + existed. Now, the event object will overwrite an older value that is + already in the globals dictionary when its ``__setitem__`` or ``update`` is + called (as well as the new ``setdefault`` method), just like a plain old + dictionary. As a result, for maximum interoperability with other + third-party subscribers, if you write an event subscriber meant to be used + as a BeforeRender subscriber, your subscriber code will now need to (using + ``.get`` or ``__contains__`` of the event object) ensure no value already + exists in the renderer globals dictionary before setting an overriding + value. + Dependency Changes ------------------ -- cgit v1.2.3 From 94ab244f121fa1bf8df57f75fad9da5f5f39c594 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 19:21:11 -0400 Subject: - The ``Configurator.add_route`` method allowed two routes with the same route to be added without an intermediate ``config.commit()``. If you now receive a ``ConfigurationError`` at startup time that appears to be ``add_route`` related, you'll need to either a) ensure that all of your route names are unique or b) call ``config.commit()`` before adding a second route with the name of a previously added name or c) use a Configurator that works in ``autocommit`` mode. --- docs/whatsnew-1.1.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 345cbfa30..b55b30238 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -497,6 +497,15 @@ Deprecations and Behavior Differences exists in the renderer globals dictionary before setting an overriding value. +- The :meth:`pyramid.config.Configurator.add_route` method allowed two routes + with the same route to be added without an intermediate call to + :meth:`pyramid.config.Configurator.commit``. If you now receive a + ``ConfigurationError`` at startup time that appears to be ``add_route`` + related, you'll need to either a) ensure that all of your route names are + unique or b) call ``config.commit()`` before adding a second route with the + name of a previously added name or c) use a Configurator that works in + ``autocommit`` mode. + Dependency Changes ------------------ -- cgit v1.2.3 From e573d4356ed0371f5ba34ff3ff396fefd2e55913 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 20:56:53 -0400 Subject: - New environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and new configuration file value ``prevent_http_cache``. These are synomymous and allow you to prevent HTTP cache headers from being set by Pyramid's ``http_cache`` machinery globally in a process. see the "Influencing HTTP Caching" section of the "View Configuration" narrative chapter and the detailed documentation for this setting in the "Environment Variables and Configuration Settings" narrative chapter. - New documentation section in View Configuration narrative chapter: "Influencing HTTP Caching". --- docs/whatsnew-1.1.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index b55b30238..20b346090 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -167,6 +167,12 @@ Minor Feature Additions to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` with the first element of ``None``, e.g.: ``(None, {'public':True})``. + The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration + file value ``prevent_http_cache`` are synomymous and allow you to prevent + HTTP cache headers from being set by Pyramid's ``http_cache`` machinery + globally in a process. see :ref:`influencing_http_caching` and + :ref:`preventing_http_caching`. + - A `JSONP `_ renderer. See :ref:`jsonp_renderer` for more details. -- cgit v1.2.3 From 100a571ebbbe7b9f7143ac6015a1b870191683d5 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:15:40 -0400 Subject: forgot to change whatsnew --- docs/whatsnew-1.1.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 20b346090..845170831 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -251,6 +251,16 @@ Minor Feature Additions preprocessor to be specified as a Python callable or Python dotted name. See https://github.com/Pylons/pyramid/pull/183 for rationale. +- New API class: :class:`pyramid.static.static_view`. This supersedes the + (now deprecated) :class:`pyramid.view.static` class. + :class:`pyramid.static.static_view`, by default, serves up documents as the + result of the request's ``path_info``, attribute rather than it's + ``subpath`` attribute (the inverse was true of + :class:`pyramid.view.static`, and still is). + :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use + when you don't want the static view to behave like the older deprecated + version. + Backwards Incompatibilities --------------------------- @@ -323,6 +333,11 @@ Deprecations and Behavior Differences and 2.6 show deprecation warnings by default, so this is unecessary there. All deprecation warnings are emitted to the console. +- The :class:`pyramid.view.static` class has been deprecated in favor of the + newer :class:`pyramid.static.static_view` class. A deprecation warning is + raised when it is used. You should replace it with a reference to + :class:`pyramid.static.static_view` with the ``use_subpath=True`` argument. + - The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands now take a single argument in the form ``/path/to/config.ini#sectionname`` rather than the previous 2-argument spelling ``/path/to/config.ini -- cgit v1.2.3 From c425a46b73a96c484de50dd9eea1595389f37b3d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:18:02 -0400 Subject: promote http_cache to major feature --- docs/whatsnew-1.1.rst | 120 ++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 57 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 845170831..388c40f46 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -29,6 +29,9 @@ The major feature additions in Pyramid 1.1 are: - Default HTTP exception view. +- ``http_cache`` view configuration parameter causes Pyramid to set HTTP + caching headers. + ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -91,6 +94,66 @@ Default HTTP Exception View exception to that of Pyramid 1.0 (the exception will propagate to middleware and to the WSGI server). +``http_cache`` +~~~~~~~~~~~~~~ + +A new value ``http_cache`` can be used as a :term:`view configuration` +parameter. + +When you supply an ``http_cache`` value to a view configuration, the +``Expires`` and ``Cache-Control`` headers of a response generated by the +associated view callable are modified. The value for ``http_cache`` may be +one of the following: + +- A nonzero integer. If it's a nonzero integer, it's treated as a number + of seconds. This number of seconds will be used to compute the + ``Expires`` header and the ``Cache-Control: max-age`` parameter of + responses to requests which call this view. For example: + ``http_cache=3600`` instructs the requesting browser to 'cache this + response for an hour, please'. + +- A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` + instance, it will be converted into a number of seconds, and that number + of seconds will be used to compute the ``Expires`` header and the + ``Cache-Control: max-age`` parameter of responses to requests which call + this view. For example: ``http_cache=datetime.timedelta(days=1)`` + instructs the requesting browser to 'cache this response for a day, + please'. + +- Zero (``0``). If the value is zero, the ``Cache-Control`` and + ``Expires`` headers present in all responses from this view will be + composed such that client browser cache (and any intermediate caches) are + instructed to never cache the response. + +- A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, + {'public':True})``), the first value in the tuple may be a nonzero + integer or a ``datetime.timedelta`` instance; in either case this value + will be used as the number of seconds to cache the response. The second + value in the tuple must be a dictionary. The values present in the + dictionary will be used as input to the ``Cache-Control`` response + header. For example: ``http_cache=(3600, {'public':True})`` means 'cache + for an hour, and add ``public`` to the Cache-Control header of the + response'. All keys and values supported by the + ``webob.cachecontrol.CacheControl`` interface may be added to the + dictionary. Supplying ``{'public':True}`` is equivalent to calling + ``response.cache_control.public = True``. + +Providing a non-tuple value as ``http_cache`` is equivalent to calling +``response.cache_expires(value)`` within your view's body. + +Providing a two-tuple value as ``http_cache`` is equivalent to calling +``response.cache_expires(value[0], **value[1])`` within your view's body. + +If you wish to avoid influencing, the ``Expires`` header, and instead wish +to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` +with the first element of ``None``, e.g.: ``(None, {'public':True})``. + +The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration +file value ``prevent_http_cache`` are synomymous and allow you to prevent +HTTP cache headers from being set by Pyramid's ``http_cache`` machinery +globally in a process. see :ref:`influencing_http_caching` and +:ref:`preventing_http_caching`. + Minor Feature Additions ----------------------- @@ -116,63 +179,6 @@ Minor Feature Additions JSON-decoded variant of the request body. If the request body is not well-formed JSON, this property will raise an exception. -- A new value ``http_cache`` can be used as a :term:`view configuration` - parameter. - - When you supply an ``http_cache`` value to a view configuration, the - ``Expires`` and ``Cache-Control`` headers of a response generated by the - associated view callable are modified. The value for ``http_cache`` may be - one of the following: - - - A nonzero integer. If it's a nonzero integer, it's treated as a number - of seconds. This number of seconds will be used to compute the - ``Expires`` header and the ``Cache-Control: max-age`` parameter of - responses to requests which call this view. For example: - ``http_cache=3600`` instructs the requesting browser to 'cache this - response for an hour, please'. - - - A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` - instance, it will be converted into a number of seconds, and that number - of seconds will be used to compute the ``Expires`` header and the - ``Cache-Control: max-age`` parameter of responses to requests which call - this view. For example: ``http_cache=datetime.timedelta(days=1)`` - instructs the requesting browser to 'cache this response for a day, - please'. - - - Zero (``0``). If the value is zero, the ``Cache-Control`` and - ``Expires`` headers present in all responses from this view will be - composed such that client browser cache (and any intermediate caches) are - instructed to never cache the response. - - - A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, - {'public':True})``), the first value in the tuple may be a nonzero - integer or a ``datetime.timedelta`` instance; in either case this value - will be used as the number of seconds to cache the response. The second - value in the tuple must be a dictionary. The values present in the - dictionary will be used as input to the ``Cache-Control`` response - header. For example: ``http_cache=(3600, {'public':True})`` means 'cache - for an hour, and add ``public`` to the Cache-Control header of the - response'. All keys and values supported by the - ``webob.cachecontrol.CacheControl`` interface may be added to the - dictionary. Supplying ``{'public':True}`` is equivalent to calling - ``response.cache_control.public = True``. - - Providing a non-tuple value as ``http_cache`` is equivalent to calling - ``response.cache_expires(value)`` within your view's body. - - Providing a two-tuple value as ``http_cache`` is equivalent to calling - ``response.cache_expires(value[0], **value[1])`` within your view's body. - - If you wish to avoid influencing, the ``Expires`` header, and instead wish - to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` - with the first element of ``None``, e.g.: ``(None, {'public':True})``. - - The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration - file value ``prevent_http_cache`` are synomymous and allow you to prevent - HTTP cache headers from being set by Pyramid's ``http_cache`` machinery - globally in a process. see :ref:`influencing_http_caching` and - :ref:`preventing_http_caching`. - - A `JSONP `_ renderer. See :ref:`jsonp_renderer` for more details. -- cgit v1.2.3 From 10408c799257d6727c968d63cf439b1ebfbfd335 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:18:46 -0400 Subject: typo --- docs/whatsnew-1.1.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 388c40f46..dd4d488a0 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -264,8 +264,7 @@ Minor Feature Additions ``subpath`` attribute (the inverse was true of :class:`pyramid.view.static`, and still is). :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use - when you don't want the static view to behave like the older deprecated - version. + when you want the static view to behave like the older deprecated version. Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From c515d77de5b2f62727251ebc32d1292e67811771 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 15 Jul 2011 10:13:07 -0400 Subject: - get_root2 -> prepare - change prepare return value to a dict, and return the registry, request, etc - various docs and changelog entries. --- docs/whatsnew-1.1.rst | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index dd4d488a0..32955ab75 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -266,6 +266,45 @@ Minor Feature Additions :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use when you want the static view to behave like the older deprecated version. +- A new API function :func:`pyramid.paster.bootstrap` has been added to make + writing scripts that bootstrap a Pyramid environment easier, e.g.: + + .. code-block:: python + + from pyramid.paster import bootstrap + info = bootstrap('/path/to/my/development.ini') + request = info['request'] + print request.route_url('myroute') + +- A new api function :func:`pyramid.scripting.prepare` has been added. It is + a lower-level analogue of :func:`pyramid.paster.boostrap` that accepts a + request and a registry instead of a config file argument, and is used for + the same purpose: + + .. code-block:: python + + from pyramid.scripting import prepare + info = prepare(registry=myregistry) + request = info['request'] + print request.route_url('myroute') + +- A new API function :func:`pyramid.scripting.make_request` has been added. + The resulting request will have a ``registry`` attribute. It is meant to + be used in conjunction with :func:`pyramid.scripting.prepare` and/or + :func:`pyramid.paster.bootstrap` (both of which accept a request as an + argument): + + .. code-block:: python + + from pyramid.scripting import make_request + request = make_request('/') + +- New API attribute :attr:`pyramid.config.global_registries` is an iterable + object that contains references to every Pyramid registry loaded into the + current process via :meth:`pyramid.config.Configurator.make_app`. It also + has a ``last`` attribute containing the last registry loaded. This is used + by the scripting machinery, and is available for introspection. + Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From 5fb458c0dd70096e5d619e42992390bb1af071e1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 01:08:43 -0400 Subject: - Added a section entitled "Writing a Script" to the "Command-Line Pyramid" chapter. --- docs/whatsnew-1.1.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 32955ab75..a37f03a66 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -583,6 +583,9 @@ Dependency Changes Documentation Enhancements -------------------------- +- Added a section entitled :ref:`writing_a_script` to the "Command-Line + Pyramid" chapter. + - The :ref:`bfg_wiki_tutorial` was updated slightly. - The :ref:`bfg_sql_wiki_tutorial` was updated slightly. -- cgit v1.2.3 From 8a8724de56c8dcce763fdb5630c77cb69a149572 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 01:29:52 -0400 Subject: promote bootstrap to major feature --- docs/whatsnew-1.1.rst | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index a37f03a66..48be2190f 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -32,6 +32,9 @@ The major feature additions in Pyramid 1.1 are: - ``http_cache`` view configuration parameter causes Pyramid to set HTTP caching headers. +- Features that make it easier to write scripts that work in a :app:`Pyramid` + environment. + ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -154,6 +157,21 @@ HTTP cache headers from being set by Pyramid's ``http_cache`` machinery globally in a process. see :ref:`influencing_http_caching` and :ref:`preventing_http_caching`. +Easier Scripting Writing +~~~~~~~~~~~~~~~~~~~~~~~~ + +A new API function :func:`pyramid.paster.bootstrap` has been added to make +writing scripts that need to work under Pyramid environment easier, e.g.: + +.. code-block:: python + + from pyramid.paster import bootstrap + info = bootstrap('/path/to/my/development.ini') + request = info['request'] + print request.route_url('myroute') + +See :ref:`writing_a_script` for more details. + Minor Feature Additions ----------------------- @@ -266,16 +284,6 @@ Minor Feature Additions :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use when you want the static view to behave like the older deprecated version. -- A new API function :func:`pyramid.paster.bootstrap` has been added to make - writing scripts that bootstrap a Pyramid environment easier, e.g.: - - .. code-block:: python - - from pyramid.paster import bootstrap - info = bootstrap('/path/to/my/development.ini') - request = info['request'] - print request.route_url('myroute') - - A new api function :func:`pyramid.scripting.prepare` has been added. It is a lower-level analogue of :func:`pyramid.paster.boostrap` that accepts a request and a registry instead of a config file argument, and is used for -- cgit v1.2.3 From 9c5b83710cd86ef4ddeae49a37518d869e504308 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 20:09:05 -0400 Subject: mention paster pshell using bootstrap --- docs/whatsnew-1.1.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 48be2190f..40deb55e4 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -184,6 +184,12 @@ Minor Feature Additions - ``paster pshell`` now offers more built-in global variables by default (including ``app`` and ``settings``). See :ref:`interactive_shell`. +- The ``paster pshell`` command now under the hood uses + :func:`pyramid.paster.bootstrap`, which makes it possible to supply an + ``.ini`` file without naming the "right" section in the file that points at + the actual Pyramid application. Instead, you can generally just run + ``paster pshell development.ini`` and it will do mostly the right thing. + - It is now possible to add a ``[pshell]`` section to your application's .ini configuration file, which influences the global names available to a pshell session. See :ref:`extending_pshell`. -- cgit v1.2.3 From af056046970db9b1d3732f4c5978fcb3fb863d1f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 21:23:07 -0400 Subject: - Change paster pviews and paster proutes to use bootstrap. --- docs/whatsnew-1.1.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 40deb55e4..9e6d7b5ae 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -181,14 +181,12 @@ Minor Feature Additions user. See "The Interactive Shell" in the "Creating a Pyramid Project" narrative documentation section. -- ``paster pshell`` now offers more built-in global variables by default - (including ``app`` and ``settings``). See :ref:`interactive_shell`. - -- The ``paster pshell`` command now under the hood uses - :func:`pyramid.paster.bootstrap`, which makes it possible to supply an - ``.ini`` file without naming the "right" section in the file that points at - the actual Pyramid application. Instead, you can generally just run - ``paster pshell development.ini`` and it will do mostly the right thing. +- The ``paster pshell``, ``paster pviews``, and ``paster proutes`` commands + each now under the hood uses :func:`pyramid.paster.bootstrap`, which makes + it possible to supply an ``.ini`` file without naming the "right" section + in the file that points at the actual Pyramid application. Instead, you + can generally just run ``paster {pshell|proutes|pviews} development.ini`` + and it will do mostly the right thing. - It is now possible to add a ``[pshell]`` section to your application's .ini configuration file, which influences the global names available to a pshell -- cgit v1.2.3 From 9006b205d907b0b52b59de0eb1e203afdcdbdd51 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 21 Jul 2011 22:05:58 -0400 Subject: add nullrenderer to whatsnew --- docs/whatsnew-1.1.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 9e6d7b5ae..6761aaff8 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -317,6 +317,16 @@ Minor Feature Additions has a ``last`` attribute containing the last registry loaded. This is used by the scripting machinery, and is available for introspection. +- Added the :attr:`pyramid.renderers.null_renderer` object as an API. The + null renderer is an object that can be used in advanced integration cases + as input to the view configuration ``renderer=`` argument. When the null + renderer is used as a view renderer argument, Pyramid avoids converting the + view callable result into a Response object. This is useful if you want to + reuse the view configuration and lookup machinery outside the context of + its use by the Pyramid router. (This feature was added for consumption by + the ``pyramid_rpc`` package, which uses view configuration and lookup + outside the context of a router in exactly this way.) + Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From acd256b2eb3304834ef0b87f499b1f85dbb014b7 Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 00:08:40 -0700 Subject: fix typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 6761aaff8..c3161a010 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -152,7 +152,7 @@ to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` with the first element of ``None``, e.g.: ``(None, {'public':True})``. The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration -file value ``prevent_http_cache`` are synomymous and allow you to prevent +file value ``prevent_http_cache`` are synonymous and allow you to prevent HTTP cache headers from being set by Pyramid's ``http_cache`` machinery globally in a process. see :ref:`influencing_http_caching` and :ref:`preventing_http_caching`. -- cgit v1.2.3 From 9f164eeb0ccd77d47e22de5d57739452dfad3cbe Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 00:41:03 -0700 Subject: removed extra word --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index c3161a010..2a637136f 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -479,7 +479,7 @@ Deprecations and Behavior Differences these methods will be removed entirely. - A custom request factory is now required to return a request object that - has a ``response`` attribute (or "reified"/lazy property) if they the + has a ``response`` attribute (or "reified"/lazy property) if the request is meant to be used in a view that uses a renderer. This ``response`` attribute should be an instance of the class :class:`pyramid.response.Response`. -- cgit v1.2.3 From a37a8e4ec1c5b78387b8e93683792c74e8aedcca Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 01:01:34 -0700 Subject: Removed extra word, corrected unfinished sentence --- docs/whatsnew-1.1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 2a637136f..300b58dbf 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -542,8 +542,8 @@ Deprecations and Behavior Differences - Deprecated the :meth:`pyramid.config.Configurator.set_renderer_globals_factory` method and the ``renderer_globals`` Configurator constructor parameter. Users should - use convert code using this feature to use a BeforeRender event als - :ref:`beforerender_event`. + convert code using this feature to use a BeforeRender event. See the section + :ref:`beforerender_event` in the Hooks chapter. - In Pyramid 1.0, the :class:`pyramid.events.subscriber` directive behaved contrary to the documentation when passed more than one interface object to -- cgit v1.2.3 From a03b793abe9a9b5719593716c0191cdc0e9b741b Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 01:06:31 -0700 Subject: Fixed typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 300b58dbf..18d0aa0b1 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -586,7 +586,7 @@ Deprecations and Behavior Differences - The :meth:`pyramid.config.Configurator.add_route` method allowed two routes with the same route to be added without an intermediate call to - :meth:`pyramid.config.Configurator.commit``. If you now receive a + :meth:`pyramid.config.Configurator.commit`. If you now receive a ``ConfigurationError`` at startup time that appears to be ``add_route`` related, you'll need to either a) ensure that all of your route names are unique or b) call ``config.commit()`` before adding a second route with the -- cgit v1.2.3 From f73f0e332658fac2583f51247dcd49bd36d63ce4 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 13 Mar 2013 23:05:17 +0200 Subject: consistency: use $VENV whenever virtualenv binaries are used --- docs/whatsnew-1.1.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 18d0aa0b1..f33fc94ba 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -395,8 +395,9 @@ Deprecations and Behavior Differences when porting your application from an older version of Pyramid. Use the ``PYTHONWARNINGS`` environment variable with the value ``all`` in the shell you use to invoke ``paster serve`` to see these warnings, e.g. on - UNIX, ``PYTHONWARNINGS=all bin/paster serve development.ini``. Python 2.5 - and 2.6 show deprecation warnings by default, so this is unecessary there. + UNIX, ``PYTHONWARNINGS=all $VENV/bin/paster serve development.ini``. + Python 2.5 and 2.6 show deprecation warnings by default, + so this is unecessary there. All deprecation warnings are emitted to the console. - The :class:`pyramid.view.static` class has been deprecated in favor of the -- cgit v1.2.3 From 50218d2d443c8773af3f2312fd0df095f993d4a9 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 1 Apr 2013 09:44:59 +0200 Subject: fix some cross-references --- docs/whatsnew-1.1.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index f33fc94ba..25ae54f32 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -43,7 +43,7 @@ The major feature additions in Pyramid 1.1 are: The object passed to a view callable as ``request`` is an instance of :class:`pyramid.request.Request`. ``request.response`` is an instance of - the class :class:`pyramid.request.Response`. View callables that are + the class :class:`pyramid.response.Response`. View callables that are configured with a :term:`renderer` will return this response object to the Pyramid router. Therefore, code in a renderer-using view callable can set response attributes such as ``request.response.content_type`` (before they @@ -289,7 +289,7 @@ Minor Feature Additions when you want the static view to behave like the older deprecated version. - A new api function :func:`pyramid.scripting.prepare` has been added. It is - a lower-level analogue of :func:`pyramid.paster.boostrap` that accepts a + a lower-level analogue of :func:`pyramid.paster.bootstrap` that accepts a request and a registry instead of a config file argument, and is used for the same purpose: @@ -313,7 +313,7 @@ Minor Feature Additions - New API attribute :attr:`pyramid.config.global_registries` is an iterable object that contains references to every Pyramid registry loaded into the - current process via :meth:`pyramid.config.Configurator.make_app`. It also + current process via :meth:`pyramid.config.Configurator.make_wsgi_app`. It also has a ``last`` attribute containing the last registry loaded. This is used by the scripting machinery, and is available for introspection. -- cgit v1.2.3 From 37607c3a9382de7c3757799791a91b80e2d9888d Mon Sep 17 00:00:00 2001 From: Catalin Iacob Date: Sun, 31 Mar 2013 14:33:24 +0200 Subject: Consistently link middleware term to the glossary --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 25ae54f32..5cba8dd3e 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -95,7 +95,7 @@ Default HTTP Exception View is passed for this value, an exception view for HTTP exceptions will not be registered. Passing ``None`` returns the behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception will propagate to - middleware and to the WSGI server). + :term:`middleware` and to the WSGI server). ``http_cache`` ~~~~~~~~~~~~~~ -- cgit v1.2.3 From 86254fc545bc67f0a0050252dfcd297cc4b49f20 Mon Sep 17 00:00:00 2001 From: tisdall Date: Thu, 8 Aug 2013 14:49:59 -0400 Subject: "unecessary" to "unnecessary" --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 5cba8dd3e..f1b8ec6f9 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -397,7 +397,7 @@ Deprecations and Behavior Differences shell you use to invoke ``paster serve`` to see these warnings, e.g. on UNIX, ``PYTHONWARNINGS=all $VENV/bin/paster serve development.ini``. Python 2.5 and 2.6 show deprecation warnings by default, - so this is unecessary there. + so this is unnecessary there. All deprecation warnings are emitted to the console. - The :class:`pyramid.view.static` class has been deprecated in favor of the -- cgit v1.2.3 From 6714a5e945d46b456f6e54c4b982566b25640949 Mon Sep 17 00:00:00 2001 From: tisdall Date: Thu, 8 Aug 2013 14:53:24 -0400 Subject: "refered" to "referred" --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index f1b8ec6f9..cc63017df 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -13,7 +13,7 @@ Terminology Changes The term "template" used by the Pyramid documentation used to refer to both "paster templates" and "rendered templates" (templates created by a rendering engine. i.e. Mako, Chameleon, Jinja, etc.). "Paster templates" will now be -refered to as "scaffolds", whereas the name for "rendered templates" will +referred to as "scaffolds", whereas the name for "rendered templates" will remain as "templates." Major Feature Additions -- cgit v1.2.3 From c6601f77f91dc933ca429d1448f4c6b27857b608 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 8 Sep 2013 22:52:54 -0400 Subject: - The ``renderer_globals_factory`` argument to the ``pyramid.config.Configurator` constructor and its ``setup_registry`` method has been removed. The ``set_renderer_globals_factory`` method of ``pyramid.config.Configurator`` has also been removed. The (internal) ``pyramid.interfaces.IRendererGlobals`` interface was also removed. These arguments, methods and interfaces had been deprecated since 1.1. Use a ``BeforeRender`` event subscriber as documented in the "Hooks" chapter of the Pyramid narrative documentation instead of providing renderer globals values to the configurator. --- docs/whatsnew-1.1.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index cc63017df..086c12ca2 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -540,11 +540,10 @@ Deprecations and Behavior Differences within a static view returns the index.html properly. See also https://github.com/Pylons/pyramid/issues/67. -- Deprecated the - :meth:`pyramid.config.Configurator.set_renderer_globals_factory` method and - the ``renderer_globals`` Configurator constructor parameter. Users should - convert code using this feature to use a BeforeRender event. See the section - :ref:`beforerender_event` in the Hooks chapter. +- Deprecated the ``pyramid.config.Configurator.set_renderer_globals_factory`` + method and the ``renderer_globals`` Configurator constructor parameter. + Users should convert code using this feature to use a BeforeRender event. See + the section :ref:`beforerender_event` in the Hooks chapter. - In Pyramid 1.0, the :class:`pyramid.events.subscriber` directive behaved contrary to the documentation when passed more than one interface object to -- cgit v1.2.3 From 2033eeb3602f330930585678aac926749b9c22f7 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 10 Feb 2014 03:22:33 -0600 Subject: - Garden PR #1121 --- docs/whatsnew-1.1.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 086c12ca2..99737b6d8 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -454,10 +454,13 @@ Deprecations and Behavior Differences renderer='some/renderer.pt') This deprecation was done to reduce confusion observed in IRC, as well as - to (eventually) reduce documentation burden (see also - https://github.com/Pylons/pyramid/issues/164). A deprecation warning is - now issued when any view-related parameter is passed to - ``add_route``. + to (eventually) reduce documentation burden. A deprecation warning is + now issued when any view-related parameter is passed to ``add_route``. + + .. seealso:: + + See also `issue #164 on GitHub + `_. - Passing an ``environ`` dictionary to the ``__call__`` method of a "traverser" (e.g. an object that implements @@ -537,8 +540,12 @@ Deprecations and Behavior Differences subdirectory, the ``index.html`` of that subdirectory would not be served properly. Instead, a redirect to ``/subdir`` would be issued. This has been fixed, and now visiting a subdirectory that contains an ``index.html`` - within a static view returns the index.html properly. See also - https://github.com/Pylons/pyramid/issues/67. + within a static view returns the index.html properly. + + .. seealso:: + + See also `issue #67 on GitHub + `_. - Deprecated the ``pyramid.config.Configurator.set_renderer_globals_factory`` method and the ``renderer_globals`` Configurator constructor parameter. -- cgit v1.2.3 From 41aeac4b9442a03c961b85b896ae84a8da3dbc9c Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 3 Jan 2016 01:06:35 -0600 Subject: fix grammar on whatsnew document titles --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 99737b6d8..a5c7f3393 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -1,4 +1,4 @@ -What's New In Pyramid 1.1 +What's New in Pyramid 1.1 ========================= This article explains the new features in Pyramid version 1.1 as compared to -- cgit v1.2.3