[Zope3-checkins] CVS: Zope3/src/zope/configuration - meta.py:1.5 metametaconfigure.py:1.5
Jim Fulton
jim@zope.com
Fri, 18 Apr 2003 18:13:01 -0400
Update of /cvs-repository/Zope3/src/zope/configuration
In directory cvs.zope.org:/tmp/cvs-serv8556/src/zope/configuration
Modified Files:
meta.py metametaconfigure.py
Log Message:
In prepration for the upcoming interface changes, I added some
new functions for making interface assertions on instances.
Rather than:
class C:
__class_implements__ = I1, I2
use:
class C:
classProvides(I1, I2)
rather than:
__implements__ = I1, I2
use:
moduleProvides(I1, I2)
rather than:
someinstance.__implements__ = I1, I2
use:
directlyProvides(I1, I2)
Note that interface assertions on persistent objects should be aboided
since the internal representation will change.
Continue to make assertions about the interfaces that class instances
implement the same way:
class C:
__implements__ = I1, I2
I also modified the core software to use the new spellings.
=== Zope3/src/zope/configuration/meta.py 1.4 => 1.5 ===
--- Zope3/src/zope/configuration/meta.py:1.4 Mon Dec 30 21:52:10 2002
+++ Zope3/src/zope/configuration/meta.py Fri Apr 18 18:12:31 2003
@@ -19,6 +19,7 @@
"""
+from zope.interface import directlyProvides, classProvides
from zope.configuration.interfaces import INonEmptyDirective
from zope.configuration.interfaces import ISubdirectiveHandler
@@ -285,7 +286,7 @@
class DirectiveNamespace:
- __class_implements__ = INonEmptyDirective
+ classProvides(INonEmptyDirective)
__implements__ = ISubdirectiveHandler
def __init__(self, _context, namespace):
@@ -300,7 +301,7 @@
def directive(self, *args, **kw):
subs, namespace = self._register(*args, **kw)
return Subdirective(subs, namespace=namespace)
- directive.__implements__ = INonEmptyDirective
+ directlyProvides(directive, INonEmptyDirective)
def __call__(self):
return ()
@@ -333,7 +334,7 @@
def subdirective(self, *args, **kw):
subs, namespace = self._register(*args, **kw)
return Subdirective(subs,namespace=namespace)
- subdirective.__implements__ = INonEmptyDirective
+ directlyProvides(subdirective, INonEmptyDirective)
def __call__(self):
return ()
=== Zope3/src/zope/configuration/metametaconfigure.py 1.4 => 1.5 ===
--- Zope3/src/zope/configuration/metametaconfigure.py:1.4 Mon Dec 30 21:52:10 2002
+++ Zope3/src/zope/configuration/metametaconfigure.py Fri Apr 18 18:12:31 2003
@@ -14,7 +14,9 @@
"""
$Id$
"""
-from zope.configuration.meta import DirectiveNamespace as bootstrapDirectiveNamespace
+from zope.interface import directlyProvides
+from zope.configuration.meta \
+ import DirectiveNamespace as bootstrapDirectiveNamespace
from zope.configuration.meta import Subdirective as bootstrapSubdirective
from zope.configuration.interfaces import INonEmptyDirective
from zope.configuration.interfaces import IEmptyDirective
@@ -49,7 +51,7 @@
return self._Subdirective(subs, namespace=namespace, name=name)
- directive.__implements__ = INonEmptyDirective
+ directlyProvides(directive, INonEmptyDirective)
class Subdirective(bootstrapSubdirective):
@@ -77,7 +79,7 @@
self._useDescription(namespace, name, subs, description)
return self.__class__(subs, namespace=namespace, name=name)
- subdirective.__implements__ = INonEmptyDirective
+ directlyProvides(subdirective, INonEmptyDirective)
def _useAttributeDescription(self, name, required, description):
pass
@@ -85,12 +87,12 @@
def attribute(self, _context, name, required='', description=''):
return Attribute(self, name, required, description)
- attribute.__implements__ = INonEmptyDirective
+ directlyProvides(attribute, INonEmptyDirective)
def description(self, _context):
return Description(self)
- description.__implements__ = INonEmptyDirective
+ directlyProvides(description, INonEmptyDirective)
class Description:
@@ -131,7 +133,7 @@
def description(self, _context):
return AttrDescription(self)
- description.__implements__ = INonEmptyDirective
+ directlyProvides(description, INonEmptyDirective)
def __call__(self):
self._dir._useAttributeDescription(