From 3b002a7b2515375e283fce953c20be823f24a224 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 6 Sep 2010 00:20:54 +0000 Subject: renderings --- CHANGES.txt | 4 +-- docs/narr/events.rst | 2 +- docs/narr/hooks.rst | 4 +-- docs/narr/i18n.rst | 4 +-- docs/narr/urldispatch.rst | 4 +-- docs/whatsnew-1.3.rst | 73 +++++++++++++++++++++++++++++++++++++++++++++ repoze/bfg/configuration.py | 16 +++++----- 7 files changed, 90 insertions(+), 17 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index bddef2b4f..340a32bce 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -30,10 +30,10 @@ Features view add_view - view, for_, context, request_type, containment + view, ``for_``, context, request_type, containment add_route() - view, view_for, factory, for_, view_context + view, view_for, factory, ``for_``, view_context scan package diff --git a/docs/narr/events.rst b/docs/narr/events.rst index 35e4120dc..a965a2765 100644 --- a/docs/narr/events.rst +++ b/docs/narr/events.rst @@ -58,7 +58,7 @@ need to use ZCML for the same purpose: The first argument to :meth:`repoze.bfg.configuration.Configurator.add_subscriber` is the - subscriber function (or a :term:`Python dotted name` which refers + subscriber function (or a :term:`dotted Python name` which refers to a subscriber callable); the second argument is the event type. .. topic:: Configuring an Event Listener Through ZCML diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index b774c2012..b00fc6727 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -352,7 +352,7 @@ The class (aka "factory") that :mod:`repoze.bfg` uses to create a request object instance can be changed by passing a ``request_factory`` argument to the constructor of the :term:`configurator`. This argument can be either a callable or a -:term:`Python dotted name` representing a callable. +:term:`dotted Python name` representing a callable. .. code-block:: python :linenos: @@ -413,7 +413,7 @@ renderer. A callback that :mod:`repoze.bfg` will call every time a renderer is invoked can be added by passing a ``renderer_globals_factory`` argument to the constructor of the :term:`configurator`. This -callback can either be a callable object or a :term:`Python dotted +callback can either be a callable object or a :term:`dotted Python name` representing such a callable. .. code-block:: python diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst index f456fe03c..cab327bb8 100644 --- a/docs/narr/i18n.rst +++ b/docs/narr/i18n.rst @@ -1013,8 +1013,8 @@ configuration using either imperative configuration or ZCML. .. topic:: Using Imperative Configuration - Pass an object which can act as the negotiator (or a :term:`Python - dotted name` referring to the object) as the ``locale_negotiator`` + Pass an object which can act as the negotiator (or a :term:`dotted + Python name` referring to the object) as the ``locale_negotiator`` argument of the :class:`repoze.bfg.configuration.Configurator` instance during application startup. diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 9779113e5..7c8bb7ce6 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -448,8 +448,8 @@ represent neither predicates nor view configuration information. application. ``factory`` - A Python object (often a function or a class) or a :term:`Python - dotted name` to such an object that will generate a + A Python object (often a function or a class) or a :term:`dotted + Python name` to such an object that will generate a :mod:`repoze.bfg` :term:`context` object when this route matches. For example, ``mypackage.models.MyFactoryClass``. If this argument is not specified, the traversal root factory will be used. diff --git a/docs/whatsnew-1.3.rst b/docs/whatsnew-1.3.rst index ec5e3f8ca..95c19960d 100644 --- a/docs/whatsnew-1.3.rst +++ b/docs/whatsnew-1.3.rst @@ -289,6 +289,63 @@ Minor Feature Additions method resolves a potentially relative :term:`resource specification` string into an absolute version. +- A new :meth:`repoze.bfg.request.Request.add_response_callback` API + has been added. This method is documented in the new + :mod:`repoze.bfg.request` API chapter. It can be used to influence + response values before a concrete response object has been created. + +- The :class:`repoze.bfg.interfaces.INewResponse` interface now + includes a ``request`` attribute; as a result, a handler for + INewResponse now has access to the request which caused the + response. + +- Each of the follow methods of the + :class:`repoze.bfg.configuration.Configurator` now allow the + below-named arguments to be passed as "dotted name strings" + (e.g. "foo.bar.baz") rather than as actual implementation objects + that must be imported: + + setup_registry + root_factory, authentication_policy, authorization_policy, + debug_logger, locale_negotiator, request_factory, + renderer_globals_factory + + add_subscriber + subscriber, iface + + derive_view + view + + add_view + view, ``for_``, context, request_type, containment + + add_route() + view, view_for, factory, ``for_``, view_context + + scan + package + + add_renderer + factory + + set_forbidden_view + view + + set_notfound_view + view + + set_request_factory + factory + + set_renderer_globals_factory() + factory + + set_locale_negotiator + negotiator + + testing_add_subscriber + event_iface + Backwards Incompatibilities --------------------------- @@ -409,6 +466,11 @@ Backwards Incompatibilities circumstances, a routing match which your application inadvertently depended upon may no longer happen. +- The :class:`repoze.bfg.interfaces.INewResponse` event is now not + sent to listeners if the response returned by view code (or a + renderer) is not a "real" response (e.g. if it does not have + ``.status``, ``.headerlist`` and ``.app_iter`` attribtues). + Deprecations and Behavior Differences ------------------------------------- @@ -527,6 +589,17 @@ Documentation Enhancements - Expanded the :ref:`redirecting_to_slash_appended_routes` section of the URL Dispatch narrative chapter. +- Add an API chapter for the :mod:`repoze.bfg.request` module, which + includes documentation for the :class:`repoze.bfg.request.Request` + class (the "request object"). + +- Modify the :ref:`webob_chapter` narrative chapter to reference the + new :mod:`repoze.bfg.request` API chapter. Some content was moved + from this chapter into the API documentation itself. + +- Various changes to denote that Python dotted names are now allowed + as input to Configurator methods. + Licensing Changes ----------------- diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py index 4ea52c571..c5ae995e5 100644 --- a/repoze/bfg/configuration.py +++ b/repoze/bfg/configuration.py @@ -301,12 +301,12 @@ class Configurator(object): return self.__class__(registry=self.registry, package=package) def maybe_dotted(self, dotted): - """ Resolve the dotted name ``dotted`` to a global Python - object. If ``dotted`` is not a string, return it without - attempting to do any name resolution. If ``dotted`` is a - relative dotted name (e.g. ``.foo.bar``, consider it relative - to the ``package`` argument supplied to this Configurator's - constructor.""" + """ Resolve the :term:`dotted Python name` ``dotted`` to a + global Python object. If ``dotted`` is not a string, return + it without attempting to do any name resolution. If + ``dotted`` is a relative dotted name (e.g. ``.foo.bar``, + consider it relative to the ``package`` argument supplied to + this Configurator's constructor.""" return self.name_resolver.maybe_resolve(dotted) def absolute_resource_spec(self, relative_spec): @@ -495,7 +495,7 @@ class Configurator(object): """Add an event :term:`subscriber` for the event stream implied by the supplied ``iface`` interface. The ``subscriber`` argument represents a callable object (or a - :ref:`Python dotted name` which identifies a callable); it + :term:`dotted Python name` which identifies a callable); it will be called with a single object ``event`` whenever :mod:`repoze.bfg` emits an :term:`event` associated with the ``iface``, which may be an :term:`interface` or a class or a @@ -1572,7 +1572,7 @@ class Configurator(object): :term:`locale negotiator` is a callable which accepts a :term:`request` object and which returns a :term:`locale name`. The ``negotiator`` argument should be the locale - negotiator implementation or a :term:`dotted Python` name + negotiator implementation or a :term:`dotted Python name` which refers to such an implementation. Later calls to this method override earlier calls; there can -- cgit v1.2.3