summaryrefslogtreecommitdiff
path: root/docs/whatsnew-1.2.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-12-17 16:00:02 +0000
committerChris McDonough <chrism@agendaless.com>2009-12-17 16:00:02 +0000
commitbc857e7e6e71a4001f03c608a18bac7dab36ccff (patch)
treea34b0b761a92791bb60b2fbfafabe79e4a675682 /docs/whatsnew-1.2.rst
parent9d73300fcef0c0cd4af9c439a900d15fa4651914 (diff)
downloadpyramid-bc857e7e6e71a4001f03c608a18bac7dab36ccff.tar.gz
pyramid-bc857e7e6e71a4001f03c608a18bac7dab36ccff.tar.bz2
pyramid-bc857e7e6e71a4001f03c608a18bac7dab36ccff.zip
Features
-------- - The ``Configurator`` object now has two new methods: ``begin`` and ``end``. The ``begin`` method is meant to be called before any "configuration" begins (e.g. before ``add_view``, et. al are called). The ``end`` method is meant to be called after all "configuration" is complete. Previously, before there was imperative configuration at all (1.1 and prior), configuration begin and end was invariably implied by the process of loading a ZCML file. When a ZCML load happened, the threadlocal data structure containing the request and registry was modified before the load, and torn down after the load, making sure that all framework code that needed ``get_current_registry`` for the duration of the ZCML load was satisfied. Some API methods called during imperative configuration, (such as ``Configurator.add_view`` when a renderer is involved) end up for historical reasons calling ``get_current_registry``. However, in 1.2a5 and below, the Configurator supplied no functionality that allowed people to make sure that ``get_current_registry`` returned the registry implied by the configurator being used. ``begin`` now serves this purpose. Inversely, ``end`` pops the thread local stack, undoing the actions of ``begin``. We make this boundary explicit to reduce the potential for confusion when the configurator is used in different circumstances (e.g. in unit tests and app code vs. just in initial app setup). Existing code written for 1.2a1-1.2a5 which does not call ``begin`` or ``end`` continues to work in the same manner it did before. It is however suggested that this code be changed to call ``begin`` and ``end`` to reduce the potential for confusion in the future. - All ``paster`` templates which generate an application skeleton now make use of the new ``begin`` and ``end`` methods of the Configurator they use in their respective copies of ``run.py`` and ``tests.py``. Documentation ------------- - All documentation that makes use of a ``Configurator`` object to do application setup and test setup now makes use of the new ``begin`` and ``end`` methods of the configurator. Bug Fixes --------- - When a ``repoze.bfg.exceptions.NotFound`` or ``repoze.bfg.exceptions.Forbidden`` *class* (as opposed to instance) was raised as an exception within a root factory (or route root factory), the exception would not be caught properly by the ``repoze.bfg.`` Router and it would propagate to up the call stack, as opposed to rendering the not found view or the forbidden view as would have been expected.
Diffstat (limited to 'docs/whatsnew-1.2.rst')
-rw-r--r--docs/whatsnew-1.2.rst15
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/whatsnew-1.2.rst b/docs/whatsnew-1.2.rst
index c417ba3ae..4332c9948 100644
--- a/docs/whatsnew-1.2.rst
+++ b/docs/whatsnew-1.2.rst
@@ -41,7 +41,9 @@ The simplest possible :mod:`repoze.bfg` application is now:
if __name__ == '__main__':
config = Configurator()
+ config.begin()
config.add_view(hello_world)
+ config.end()
app = config.make_wsgi_app()
simple_server.make_server('', 8080, app).serve_forever()
@@ -141,10 +143,11 @@ Backwards Incompatibilites
- When there is no "current registry" in the
``repoze.bfg.threadlocal.manager`` threadlocal data structure (this
is the case when there is no "current request" or we're not in the
- midst of a ``r.b.testing.setUp``-bounded unit test), the ``.get``
- method of the manager returns a data structure containing a *global*
- registry. In previous releases, this function returned the global
- Zope "base" registry: the result of
+ midst of a ``r.b.testing.setUp`` or
+ ``r.b.configuration.Configurator.begin`` bounded unit test), the
+ ``.get`` method of the manager returns a data structure containing a
+ *global* registry. In previous releases, this function returned the
+ global Zope "base" registry: the result of
``zope.component.getGlobalSiteManager``, which is an instance of the
``zope.component.registry.Component`` class. In this release,
however, the global registry returns a globally importable instance
@@ -153,8 +156,8 @@ Backwards Incompatibilites
``repoze.bfg.registry.global_registry``.
Effectively, this means that when you call
- ``repoze.bfg.threadlocal.get_current_registry`` when no request or
- ``setUp`` bounded unit test is in effect, you will always get back
+ ``repoze.bfg.threadlocal.get_current_registry`` when no "real"
+ request or bounded unit test is in effect, you will always get back
the global registry that lives in
``repoze.bfg.registry.global_registry``. It also means that
:mod:`repoze.bfg` APIs that *call* ``get_current_registry`` will use