[Checkins] SVN: zope.app.component/trunk/ Remove factory directive.
Dan Korostelev
nadako at gmail.com
Sat Dec 13 17:16:56 EST 2008
Log message for revision 94039:
Remove factory directive.
Changed:
U zope.app.component/trunk/CHANGES.txt
U zope.app.component/trunk/src/zope/app/component/meta.zcml
U zope.app.component/trunk/src/zope/app/component/metaconfigure.py
U zope.app.component/trunk/src/zope/app/component/metadirectives.py
U zope.app.component/trunk/src/zope/app/component/tests/test_directives.py
-=-
Modified: zope.app.component/trunk/CHANGES.txt
===================================================================
--- zope.app.component/trunk/CHANGES.txt 2008-12-13 22:12:06 UTC (rev 94038)
+++ zope.app.component/trunk/CHANGES.txt 2008-12-13 22:16:56 UTC (rev 94039)
@@ -12,6 +12,7 @@
* zope.app.component.interface module that was moved to
zope.component.interface ages ago.
* zope:content and zope:localUtility directives.
+ * zope:factory directive.
- Remove "back35" extras_require as it doesn't make
any sense now.
Modified: zope.app.component/trunk/src/zope/app/component/meta.zcml
===================================================================
--- zope.app.component/trunk/src/zope/app/component/meta.zcml 2008-12-13 22:12:06 UTC (rev 94038)
+++ zope.app.component/trunk/src/zope/app/component/meta.zcml 2008-12-13 22:16:56 UTC (rev 94039)
@@ -6,14 +6,7 @@
<meta:directives namespace="http://namespaces.zope.org/zope">
- <!-- BBB 2006/02/24, to be removed after 12 months -->
<meta:directive
- name="factory"
- schema=".metadirectives.IFactoryDirective"
- handler="zope.app.component.metaconfigure.factory"
- />
-
- <meta:directive
name="view"
schema=".metadirectives.IViewDirective"
handler="zope.app.component.metaconfigure.view"
Modified: zope.app.component/trunk/src/zope/app/component/metaconfigure.py
===================================================================
--- zope.app.component/trunk/src/zope/app/component/metaconfigure.py 2008-12-13 22:12:06 UTC (rev 94038)
+++ zope.app.component/trunk/src/zope/app/component/metaconfigure.py 2008-12-13 22:16:56 UTC (rev 94039)
@@ -38,33 +38,6 @@
)
-
-# 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
-
- if description is not None:
- component.description = description
-
- utility(_context, IFactory, component,
- permission=PublicPermission, name=id)
-
-
def _checker(_context, permission, allowed_interface, allowed_attributes):
if (not allowed_attributes) and (not allowed_interface):
allowed_attributes = ["__call__"]
Modified: zope.app.component/trunk/src/zope/app/component/metadirectives.py
===================================================================
--- zope.app.component/trunk/src/zope/app/component/metadirectives.py 2008-12-13 22:12:06 UTC (rev 94038)
+++ zope.app.component/trunk/src/zope/app/component/metadirectives.py 2008-12-13 22:16:56 UTC (rev 94039)
@@ -119,48 +119,6 @@
)
-# BBB 2006/02/24, to be removed after 12 months
-class IFactoryDirective(zope.interface.Interface):
- """
- *BBB: DEPRECATED*
-
- The ``factory`` directive has been deprecated and will be
- removed in Zope 3.5. Use the ``utility`` directive instead::
-
- <utility
- provides="zope.component.interfaces.IFactory"
- component="some.factory.class"
- name="factoryName"
- />
-
- (Define a factory.)
- """
-
- component = zope.configuration.fields.GlobalObject(
- title=_("Component to be used"),
- required=True,
- )
-
- id = zope.schema.Id(
- title=_("ID"),
- required=False,
- )
-
- title = zope.configuration.fields.MessageID(
- title=_("Title"),
- description=_("Text suitable for use in the 'add content' menu of"
- " a management interface"),
- required=False,
- )
-
- description = zope.configuration.fields.MessageID(
- title=_("Description"),
- description=_("Longer narrative description of what this factory"
- " does"),
- required=False,
- )
-
-
class IViewDirective(IBasicViewInformation, IBasicResourceInformation):
"""Register a view for a component"""
Modified: zope.app.component/trunk/src/zope/app/component/tests/test_directives.py
===================================================================
--- zope.app.component/trunk/src/zope/app/component/tests/test_directives.py 2008-12-13 22:12:06 UTC (rev 94038)
+++ zope.app.component/trunk/src/zope/app/component/tests/test_directives.py 2008-12-13 22:16:56 UTC (rev 94039)
@@ -485,28 +485,7 @@
))
self.assertRaises(ValueError, xmlconfig, config, testing=1)
- # BBB 2006/02/24, to be removed after 12 months
- def testFactory(self):
- showwarning = warnings.showwarning
- warnings.showwarning = lambda *a, **k: None
- self.assertRaises(ComponentLookupError, zope.component.createObject,
- 'foo')
-
- xmlconfig(StringIO(template % (
- '''
- <factory
- id="foo.bar"
- component="zope.app.component.tests.factory.f"
- />
- '''
- )))
-
- from factory import X
- self.assertEqual(zope.component.createObject('foo.bar').__class__, X)
-
- warnings.showwarning = showwarning
-
class ParticipationStub(object):
def __init__(self, principal):
More information about the Checkins
mailing list