[Zope3-checkins]
SVN: Zope3/branches/philikon-reduce-zcml/src/zope/app/component/meta
Deprecate the <factory /> directive.
Philipp von Weitershausen
philikon at philikon.de
Sat Feb 25 12:21:05 EST 2006
Log message for revision 63437:
Deprecate the <factory /> directive.
Changed:
U Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metaconfigure.py
U Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metadirectives.py
-=-
Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metaconfigure.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metaconfigure.py 2006-01-02 19:58:46 UTC (rev 63436)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metaconfigure.py 2006-02-25 17:21:04 UTC (rev 63437)
@@ -17,10 +17,11 @@
"""
__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
@@ -267,7 +268,22 @@
args = (provides.__module__ + '.' + provides.getName(), provides)
)
+# BBB 2006/02/24, to be removed after 12 months
def factory(_context, component, id, title=None, description=None):
+ try:
+ dottedname = component.__module__ + "." + component.__name__
+ except AttributeError:
+ dottedname = '...'
+ warnings.warn_explicit(
+ "The 'factory' directive has been deprecated and will be "
+ "removed in Zope 3.5. Use the 'utility' directive instead:\n"
+ ' <utility\n'
+ ' provides="zope.component.interfaces.IFactory"\n'
+ ' component="%s"\n'
+ ' name="%s"\n'
+ ' />' % (dottedname, id),
+ DeprecationWarning, _context.info.file, _context.info.line)
+
if title is not None:
component.title = title
Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metadirectives.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metadirectives.py 2006-01-02 19:58:46 UTC (rev 63436)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/component/metadirectives.py 2006-02-25 17:21:04 UTC (rev 63437)
@@ -311,6 +311,7 @@
required=False,
)
+# BBB 2006/02/24, to be removed after 12 months
class IFactoryDirective(zope.interface.Interface):
"""Define a factory"""
More information about the Zope3-Checkins
mailing list