summaryrefslogtreecommitdiff
path: root/CHANGES.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CHANGES.txt')
-rw-r--r--CHANGES.txt101
1 files changed, 100 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 0254ac2b0..c58ff755b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -39,6 +39,11 @@ Documentation
- Added API docs for ``pyramid.authentication.SessionAuthenticationPolicy``.
+- Added API docs for ``pyramid.httpexceptions.responsecode``.
+
+- Added "HTTP Exceptions" section to Views narrative chapter including a
+ description of ``pyramid.httpexceptions.responsecode``.
+
Features
--------
@@ -109,6 +114,48 @@ Features
section entitled "Static Routes" in the URL Dispatch narrative chapter for
more information.
+- A default exception view for the context
+ ``pyramid.interfaces.IExceptionResponse`` is now registered by default.
+ This means that an instance of any exception response 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.
+
+- A function named ``pyramid.httpexceptions.responsecode`` is a shortcut that
+ can be used to create HTTP exception response objects using an HTTP integer
+ status code.
+
+- The Configurator now 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 a response is raised
+ as an exception. When ``None`` is passed for this value, an exception view
+ for responses 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).
+
+- The ``pyramid.request.Request`` class now has a ``ResponseClass`` interface
+ which points at ``pyramid.response.Response``.
+
+- The ``pyramid.request.Response`` class now has a ``RequestClass`` interface
+ which points at ``pyramid.response.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
+ ``pyramid.interfaces.IResponse`` is registered for the type of the returned
+ object by using the new
+ ``pyramid.config.Configurator.add_response_adapter`` API. See the section
+ in the Hooks chapter of the documentation entitled "Changing How Pyramid
+ Treats View Responses".
+
+- The Pyramid router will now, by default, call the ``__call__`` method of
+ WebOb response objects when returning a WSGI response. This means that,
+ among other things, the ``conditional_response`` feature of WebOb response
+ objects will now behave properly.
+
+- New method named ``pyramid.request.Request.is_response``. This method
+ should be used instead of the ``pyramid.view.is_response`` function, which
+ has been deprecated.
+
Bug Fixes
---------
@@ -239,6 +286,14 @@ Deprecations
1.0 and before). In a future version, these methods will be removed
entirely.
+- Deprecated ``pyramid.view.is_response`` function in favor of (newly-added)
+ ``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
+ ``pyramid.view.is_response`` function will still work until it is removed,
+ but now may return an incorrect answer under some (very uncommon)
+ circumstances.
+
Behavior Changes
----------------
@@ -249,7 +304,7 @@ Behavior Changes
For example, ${ myhtml | n }.
See https://github.com/Pylons/pyramid/issues/193.
-- 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
@@ -280,6 +335,50 @@ Behavior Changes
implements its own ``__getattr__``, ``__setattr__`` or ``__delattr__`` as a
result.
+- ``pyramid.response.Response`` is now a *subclass* of
+ ``webob.response.Response`` (in order to directly implement the
+ ``pyramid.interfaces.IResponse`` interface).
+
+- 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. We do this in order to a)
+ allow the exception responses to subclass ``pyramid.response.Response``,
+ which speeds up response generation slightly due to the way the Pyramid
+ router works, b) allows us to provide alternate __call__ logic which also
+ speeds up response generation, c) allows the exception classes to provide
+ for the proper value of ``self.RequestClass`` (pyramid.request.Request), d)
+ allows us freedom from having to think about backwards compatibility code
+ present in ``webob.exc`` having to do with Python 2.4, which we no longer
+ support, e) We change the behavior of two classes (HTTPNotFound and
+ HTTPForbidden) in the module so that they can be used internally for
+ notfound and forbidden exceptions, f) allows us to influence the docstrings
+ of the exception classes to provide Pyramid-specific documentation, and g)
+ allows us to silence a stupid deprecation warning under Python 2.6 when the
+ response objects are used as exceptions (related to ``self.message``).
+
+Backwards Incompatibilities
+---------------------------
+
+- The Pyramid router now, by default, expects response objects returned from
+ view callables to implement the ``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 "Changing How
+ Pyramid Treats View Responses".
+
+- The ``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.
+
Dependencies
------------