From 358dc276d28fb395a9a742ff53dc66ee115c58ad Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 11 Jan 2009 02:20:52 +0000 Subject: Merge router-simplify branch. Changelog below. Bug Fixes --------- - Fix a bug where the Paste configuration's ``unicode_path_segments`` (and os.environ's ``BFG_UNICODE_PATH_SEGMENTS``) may have been defaulting to false in some circumstances. It now always defaults to true, matching the documentation and intent. - The ``repoze.bfg.traversal.find_model`` API did not work properly when passed a ``path`` argument which was unicode and contained high-order bytes when the ``unicode_path_segments`` or ``BFG_UNICODE_PATH_SEGMENTS`` configuration variables were "true". - A new module was added: ``repoze.bfg.settings``. This contains deployment-settings-related code. Behavior Changes ---------------- - The ``make_app`` callable within ``repoze.bfg.router`` now registers the ``root_policy`` argument as a utility (unnamed, using the new ``repoze.bfg.interfaces.IRootFactory`` as a provides interface) rather than passing it as the first argument to the ``repoze.bfg.router.Router`` class. As a result the ``repoze.bfg.router.Router`` router class only accepts a single argument: ``registry``. The ``repoze.bfg.router.Router`` class retrieves the root policy via a utility lookup now. The ``repoze.bfg.router.make_app`` API also now performs some important application registrations that were previously handled inside ``repoze.bfg.registry.makeRegistry``. - The ``repoze.bfg.settings.Settings`` class (an instance of which is registered as a utility providing ``repoze.bfg.interfaces.ISettings`` when any application is started) now automatically calls ``repoze.bfg.settings.get_options`` on the options passed to its constructor. This means that usage of ``get_options`` within an application's ``make_app`` function is no longer required (the "raw" ``options`` dict or None may be passed). Deprecations ------------ - Moved the ``repoze.bfg.registry.Settings`` class. This has been moved to ``repoze.bfg.settings.Settings``. A deprecation warning is issued when it is imported from the older location. - Moved the ``repoze.bfg.registry.get_options`` function This has been moved to ``repoze.bfg.settings.get_options``. A deprecation warning is issued when it is imported from the older location. - The ``repoze.bfg.interfaces.IRootPolicy`` interface was renamed within the interfaces package. It has been renamed to ``IRootFactory``. A deprecation warning is issued when it is imported from the older location. --- repoze/bfg/interfaces.py | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index b05558c81..70d6648e3 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -1,9 +1,33 @@ from zope.interface import Interface from zope.interface import Attribute -from zope.deprecation import deprecated +from zope.deferredimport import deprecated from zope.component.interfaces import IObjectEvent +deprecated( + '(repoze.bfg.interfaces.ITemplate should now be imported ' + 'as repoze.bfg.interfaces.ITemplateRenderer)', + ITemplate = 'repoze.bfg.interfaces:INodeTemplateRenderer', + ) + +deprecated( + '(repoze.bfg.interfaces.INodeTemplate should now be imported ' + 'as repoze.bfg.interfaces.INodeTemplateRenderer)', + INodeTemplate = 'repoze.bfg.interfaces:INodeTemplateRenderer', + ) + +deprecated( + '(repoze.bfg.interfaces.ITemplateFactory should now be imported ' + 'as repoze.bfg.interfaces.ITemplateRendererFactory)', + ITemplateFactory = 'repoze.bfg.interfaces:ITemplateRendererFactory', + ) + +deprecated( + '(repoze.bfg.interfaces.IRootPolicy should now be imported ' + 'as repoze.bfg.interfaces.IRootFactory)', + IRootPolicy = "repoze.bfg.interfaces:IRootFactory", + ) + class IRequest(Interface): """ Marker interface for a request object """ @@ -16,7 +40,7 @@ class IView(Interface): def __call__(context, request): """ Must return an object that implements IResponse """ -class IRootPolicy(Interface): +class IRootFactory(Interface): def __call__(environ): """ Return a root object """ @@ -49,19 +73,6 @@ class INodeTemplateRenderer(Interface): def __call__(node, **kw): """ Return a string result given a node and a template path """ -ITemplate = ITemplateRenderer -deprecated('ITemplate', - ('repoze.bfg.interfaces.ITemplate should now be imported ' - 'as repoze.bfg.interfaces.ITemplateRenderer')) -INodeTemplate = INodeTemplateRenderer -deprecated('INodeTemplate', - ('repoze.bfg.interfaces.INodeTemplate should now be imported ' - 'as repoze.bfg.interfaces.INodeTemplateRenderer')) -ITemplateFactory = ITemplateRendererFactory -deprecated('ITemplateFactory', - ('repoze.bfg.interfaces.ITemplateFactory should now be imported ' - 'as repoze.bfg.interfaces.ITemplateRendererFactory')) - class ISecurityPolicy(Interface): """ A utility that provides a mechanism to check authorization using authentication data """ -- cgit v1.2.3