[Zope3-checkins]
SVN: Zope3/branches/philikon-simplify-skinning/src/zope/app/component/meta
Deprecate the 'layer' argument of view and resource. They
already had
Philipp von Weitershausen
philikon at philikon.de
Tue Feb 21 09:13:49 EST 2006
Log message for revision 41725:
Deprecate the 'layer' argument of view and resource. They already had
a 'type' argument that should be used now exclusively.
Changed:
U Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metaconfigure.py
U Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metadirectives.py
-=-
Modified: Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metaconfigure.py 2006-02-21 13:27:44 UTC (rev 41724)
+++ Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metaconfigure.py 2006-02-21 14:13:48 UTC (rev 41725)
@@ -17,13 +17,13 @@
"""
__docformat__ = 'restructuredtext'
+import warnings
+import zope.interface
from zope import component
from zope.component.interfaces import IDefaultViewName, IFactory
from zope.configuration.exceptions import ConfigurationError
-import zope.interface
from zope.interface import Interface, providedBy
from zope.interface.interfaces import IInterface
-
from zope.proxy import ProxyBase, getProxiedObject
from zope.security.checker import InterfaceChecker, CheckerPublic
@@ -310,7 +310,6 @@
)
if permission:
-
checker = _checker(_context, permission,
allowed_interface, allowed_attributes)
@@ -319,14 +318,18 @@
factory = proxyResource
- if layer is None:
- layer = type
+ if layer is not None:
+ warnings.warn_explicit(
+ "The 'layer' argument of the 'resource' directive has been "
+ "deprecated. Use the 'type' argument instead.",
+ DeprecationWarning, _context.info.file, _context.info.line)
+ type = layer
_context.action(
- discriminator = ('resource', name, layer, provides),
+ discriminator = ('resource', name, type, provides),
callable = handler,
args = ('provideAdapter',
- (layer,), provides, name, factory, _context.info),
+ (type,), provides, name, factory, _context.info),
)
_context.action(
discriminator = None,
@@ -389,9 +392,13 @@
ob = f(ob)
return factories[-1](ob, request)
- # if layer not specified, use default layer for type
+ # BBB 2006/02/18, to be removed after 12 months
if layer is not None:
for_ = for_ + (layer,)
+ warnings.warn_explicit(
+ "The 'layer' argument of the 'view' directive has been "
+ "deprecated. Use the 'type' argument instead.",
+ DeprecationWarning, _context.info.file, _context.info.line)
else:
for_ = for_ + (type,)
Modified: Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metadirectives.py
===================================================================
--- Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metadirectives.py 2006-02-21 13:27:44 UTC (rev 41724)
+++ Zope3/branches/philikon-simplify-skinning/src/zope/app/component/metadirectives.py 2006-02-21 14:13:48 UTC (rev 41725)
@@ -85,6 +85,7 @@
required=False,
)
+ # BBB 2006/02/18, to be removed after 12 months
layer = zope.app.component.fields.LayerField(
title=_("The layer the view is in."),
description=_("""
@@ -379,8 +380,11 @@
IBasicResourceInformation):
"""Register a resource"""
+ # BBB 2006/02/18, to be removed after 12 months
layer = zope.app.component.fields.LayerField(
- title=_("The layer the resource is in."),
+ title=_("The layer the resource is in. This argument has been "
+ "deprecated and will be removed in Zope 3.5. Use the "
+ "'type' argument instead."),
required=False,
)
@@ -518,8 +522,10 @@
# BBB: Deprecated. Will go away in 3.4.
class IDefaultLayerDirective(zope.interface.Interface):
- """Associate a default layer with a request type."""
+ """Associate a default layer with a request type.
+ This directive has been deprecated and will go away in Zope 3.4."""
+
type = zope.configuration.fields.GlobalInterface(
title=_("Request type"),
required=True
More information about the Zope3-Checkins
mailing list