diff options
| -rw-r--r-- | CHANGES.txt | 20 | ||||
| -rw-r--r-- | repoze/bfg/interfaces.py | 38 | ||||
| -rw-r--r-- | repoze/bfg/registry.py | 12 | ||||
| -rw-r--r-- | repoze/bfg/traversal.py | 34 | ||||
| -rw-r--r-- | repoze/bfg/urldispatch.py | 28 | ||||
| -rw-r--r-- | setup.py | 1 |
6 files changed, 70 insertions, 63 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 21e792fe2..a600126ed 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,26 @@ 0.8dev ====== +Deprecation Warnings and Import Alias Removals +--------------------------------------------- + +- Since version 0.6.1, a deprecation warning has been emitted when the + name ``model_url`` is imported from the ``repoze.bfg.traversal`` + module. This import alias (and the deprecation warning) has been + removed. Any import of the ``model_url`` function will now need to + be done from ``repoze.bfg.url``; any import of the name + ``model_url`` from ``repoze.bfg.traversal`` will now fail. This was + done to remove a dependency on zope.deferredimport. + +- Since version 0.6.5, a deprecation warning has been emitted when the + name ``RoutesModelTraverser`` is imported from the + ``repoze.bfg.traversal`` module. This import alias (and the + deprecation warning) has been removed. Any import of the + ``RoutesModelTraverser`` class will now need to be done from + ``repoze.bfg.urldispatch``; any import of the name + ``RoutesModelTraverser`` from ``repoze.bfg.traversal`` will now + fail. This was done to remove a dependency on zope.deferredimport. + Features -------- diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 8f75a4f4a..f9a0a17e5 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -1,28 +1,10 @@ from zope.interface import Attribute from zope.interface import Interface -from zope.deferredimport import deprecated +from zope.deprecation 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:ITemplateRenderer', - ) - -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 IRequestFactory(Interface): """ A utility which generates a request object """ def __call__(): @@ -69,6 +51,12 @@ class IRootFactory(Interface): def __call__(environ): """ Return a root object """ +IRootPolicy = IRootFactory +deprecated('IRootPolicy', + '(repoze.bfg.interfaces.IRootPolicy should now be imported ' + 'as repoze.bfg.interfaces.IRootFactory)', + ) + class ITraverser(Interface): def __call__(environ): """ Return a tuple in the form ``(context, view_name, subpath, @@ -102,10 +90,22 @@ class ITemplateRenderer(Interface): passed in as arguments and return the result (a string or unicode object) """ +ITemplate = ITemplateRenderer +deprecated('ITemplate', + '(repoze.bfg.interfaces.ITemplate should now be imported ' + 'as repoze.bfg.interfaces.ITemplateRenderer)', + ) + class ITemplateRendererFactory(Interface): def __call__(path, auto_reload=False): """ Return an object that implements ``ITemplateRenderer`` """ +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 """ diff --git a/repoze/bfg/registry.py b/repoze/bfg/registry.py index 41012a7c9..f73e131d5 100644 --- a/repoze/bfg/registry.py +++ b/repoze/bfg/registry.py @@ -8,20 +8,22 @@ from zope.component.interfaces import ComponentLookupError from zope.component.interfaces import IComponentLookup from zope.component.registry import Components -from zope.deferredimport import deprecated +from zope.deprecation import deprecated from repoze.bfg.zcml import zcml_configure -deprecated( +from repoze.bfg.settings import Settings # alias for deprecation below + +deprecated('Settings', "('from repoze.bfg.registry import Settings' is now " "deprecated; instead use 'from repoze.bfg.settings import Settings')", - Settings = "repoze.bfg.settings:Settings", ) -deprecated( +from repoze.bfg.settings import get_options # alias for deprecation below + +deprecated('get_options', "('from repoze.bfg.registry import get_options' is now " "deprecated; instead use 'from repoze.bfg.settings import get_options')", - get_options = "repoze.bfg.settings:get_options", ) class Registry(Components): diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py index 9da1818fc..572c31e74 100644 --- a/repoze/bfg/traversal.py +++ b/repoze/bfg/traversal.py @@ -4,8 +4,8 @@ import urllib from zope.component import getMultiAdapter from zope.component import queryUtility -from zope.deferredimport import deprecated - +from zope.deprecation import deprecated + from zope.interface import classProvides from zope.interface import implements @@ -19,28 +19,6 @@ from repoze.bfg.interfaces import ITraverserFactory from repoze.bfg.interfaces import VH_ROOT_KEY from repoze.bfg.interfaces import ILogger -deprecated( - "('from repoze.bfg.traversal import model_url' is now " - "deprecated; instead use 'from repoze.bfg.url import model_url')", - model_url = "repoze.bfg.url:model_url", - ) - -deprecated( - "('from repoze.bfg.traversal import RoutesModelTraverser' is now " - "deprecated; instead use 'from repoze.bfg.urldispatch " - "import RoutesModelTraverser')", - RoutesModelTraverser = "repoze.bfg.urldispatch:RoutesModelTraverser", - ) - -# ``split_path`` wasn't actually ever an API but people were using it -# anyway. I turned it into the ``traversal_path`` API in 0.6.5, and -# generate the below deprecation to give folks a heads up. -deprecated( - "('from repoze.bfg.traversal import split_path' is now deprecated; " - "instead use 'from repoze.bfg.traversal import traversal_path')", - split_path = "repoze.bfg.traversal:traversal_path", - ) - def find_root(model): """ Find the root node in the graph to which ``model`` belongs. Note that ``model`` should be :term:`location`-aware. @@ -331,6 +309,14 @@ def traversal_path(path): clean.append(segment) return tuple(clean) +# ``split_path`` wasn't actually ever an API but people were using it +# anyway. I turned it into the ``traversal_path`` API in 0.6.5, and +# generate the below deprecation to give folks a heads up. +deprecated('split_path', + "('from repoze.bfg.traversal import split_path' is now deprecated; " + "instead use 'from repoze.bfg.traversal import traversal_path')", + ) + _segment_cache = {} def quote_path_segment(segment): diff --git a/repoze/bfg/urldispatch.py b/repoze/bfg/urldispatch.py index 96650f9a5..526db3a9a 100644 --- a/repoze/bfg/urldispatch.py +++ b/repoze/bfg/urldispatch.py @@ -15,28 +15,22 @@ from repoze.bfg.interfaces import IRoutesContext from repoze.bfg.interfaces import ITraverser from repoze.bfg.interfaces import ITraverserFactory -from zope.deferredimport import deprecated -from zope.deprecation import deprecated as deprecated2 +from zope.deprecation import deprecated _marker = () -deprecated( - "('from repoze.bfg.urldispatch import RoutesContext' is now " - "deprecated; instead use 'from repoze.bfg.urldispatch import " - "DefaultRoutesContext')", - RoutesContext = "repoze.bfg.urldispatch:DefaultRoutesContext", - ) - -deprecated2('RoutesMapper', - 'Usage of the ``RoutesMapper`` class is deprecated. As of ' - 'repoze.bfg 0.6.3, you should use the ``<route.. >`` ZCML ' - 'directive instead of manually creating a RoutesMapper.') - class DefaultRoutesContext(object): implements(IRoutesContext) def __init__(self, **kw): self.__dict__.update(kw) +RoutesContext = DefaultRoutesContext +deprecated('RoutesContext', + "('from repoze.bfg.urldispatch import RoutesContext' is now " + "deprecated; instead use 'from repoze.bfg.urldispatch import " + "DefaultRoutesContext')", + ) + class RoutesMapper(object): """ The ``RoutesMapper`` is a wrapper for the ``get_root`` callable passed in to the repoze.bfg ``Router`` at initialization @@ -110,6 +104,12 @@ class RoutesMapper(object): self.mapper.connect(*arg, **kw) +deprecated('RoutesMapper', + 'Usage of the ``RoutesMapper`` class is deprecated. As of ' + 'repoze.bfg 0.6.3, you should use the ``<route.. >`` ZCML ' + 'directive instead of manually creating a RoutesMapper.', + ) + class RoutesContextNotFound(object): implements(IContextNotFound) def __init__(self, msg): @@ -38,7 +38,6 @@ install_requires=[ 'zope.interface >= 3.5.1', # 3.5.0 comment: "allow to bootstrap on jython" 'zope.component >= 3.6.0', # independent of zope.hookable 'zope.testing', - 'zope.deferredimport', 'zope.deprecation', 'repoze.zcml', 'martian', |
