[Zope3-checkins] CVS: Zope3/src/zope/app/schemagen - modulegen.py:1.2.26.1 schemaspec.py:1.2.26.1 typereg.py:1.3.24.1

Grégoire Weber zope@i-con.ch
Sun, 22 Jun 2003 10:24:27 -0400


Update of /cvs-repository/Zope3/src/zope/app/schemagen
In directory cvs.zope.org:/tmp/cvs-serv24874/src/zope/app/schemagen

Modified Files:
      Tag: cw-mail-branch
	modulegen.py schemaspec.py typereg.py 
Log Message:
Synced up with HEAD

=== Zope3/src/zope/app/schemagen/modulegen.py 1.2 => 1.2.26.1 ===
--- Zope3/src/zope/app/schemagen/modulegen.py:1.2	Wed Dec 25 09:13:14 2002
+++ Zope3/src/zope/app/schemagen/modulegen.py	Sun Jun 22 10:23:22 2003
@@ -46,7 +46,7 @@
     property_text = '\n'.join(property_text_list)
 
     text = '''\
-from zope.interface import Interface
+from zope.interface import Interface, implements
 from persistence import Persistent
 from zope.schema.fieldproperty import FieldProperty
 
@@ -59,7 +59,7 @@
 
 class %(class_name)s(Persistent):
     """Autogenerated class for %(schema_name)s."""
-    __implements__ = %(schema_name)s
+    implements(%(schema_name)s)
 
     def __init__(self):
         self.__schema_version__ = %(schema_version)s


=== Zope3/src/zope/app/schemagen/schemaspec.py 1.2 => 1.2.26.1 ===
--- Zope3/src/zope/app/schemagen/schemaspec.py:1.2	Wed Dec 25 09:13:14 2002
+++ Zope3/src/zope/app/schemagen/schemaspec.py	Sun Jun 22 10:23:22 2003
@@ -19,12 +19,13 @@
 from zope.app.interfaces.schemagen import ISchemaSpec
 from persistence import Persistent
 from zope.app.schemagen.modulegen import generateModuleSource
+from zope.interface import implements
 
 _helper_import = 'from zope.app.schemagen import schemaspec'
 _helper_module = 'schemaspec'
 
 class SchemaSpec(Persistent):
-    __implements__ = ISchemaSpec
+    implements(ISchemaSpec)
 
     def __init__(self, schema_name, class_name=None):
         if class_name is None:


=== Zope3/src/zope/app/schemagen/typereg.py 1.3 => 1.3.24.1 ===
--- Zope3/src/zope/app/schemagen/typereg.py:1.3	Wed Jan  8 15:18:29 2003
+++ Zope3/src/zope/app/schemagen/typereg.py	Sun Jun 22 10:23:22 2003
@@ -18,7 +18,7 @@
 $Id$
 """
 
-from zope.interface.implements import visitImplements
+from zope.interface import implements, providedBy
 from zope.schema import getFields
 
 from zope.app.interfaces.schemagen import ITypeRepresentation
@@ -43,7 +43,7 @@
             self._registry[type] = representation
 
 class DefaultTypeRepresentation:
-    __implements__ = ITypeRepresentation
+    implements(ITypeRepresentation)
 
     def __init__(self, object):
         self.text = repr(object)
@@ -59,7 +59,7 @@
     getTypes = staticmethod(getTypes)
 
 class DatetimeRepresentation:
-    __implements__ = ITypeRepresentation
+    implements(ITypeRepresentation)
 
     def __init__(self, dt):
         r = repr(dt)
@@ -79,18 +79,18 @@
     getTypes = staticmethod(getTypes)
 
 class DefaultFieldRepresentation:
-    __implements__ = ITypeRepresentation
+    implements(ITypeRepresentation)
 
     def __init__(self, field):
-        # This field is described by a schema, or schemas, as found in its
-        # __implements__ attribute. The fields of this field's schema are
+        # This field is described by a schema, or schemas, as found by
+        # providedBy. The fields of this field's schema are
         # its properties -- that is, the things we give as arguments when
         # constructing this field.
         # We're going to get these properties, get source-code
         # representations of them, and sort out appropriate imports.
         names = {} # used as set of property names, ignoring values
-        visitImplements(field.__implements__, field,
-                        lambda interface: names.update(getFields(interface)))
+        for interface in providedBy(field):
+            names.update(getFields(interface))
         # getFields only returns data for Fields in the interface.
         # Otherwise, it returns an empty dict.