[Zope3-checkins] CVS: Zope3/src/zope/app/utilities - interfaces.py:1.1.2.2 mutableschemafield.py:1.1.2.2 schema.py:1.1.2.3

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 13 10:20:49 EDT 2003


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

Modified Files:
      Tag: dreamcatcher-ttwschema-branch
	interfaces.py mutableschemafield.py schema.py 
Log Message:
ZPL Headers

Some more Docs

added setName to MutableSchema


=== Zope3/src/zope/app/utilities/interfaces.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/utilities/interfaces.py:1.1.2.1	Tue Aug 12 09:19:27 2003
+++ Zope3/src/zope/app/utilities/interfaces.py	Wed Aug 13 09:20:44 2003
@@ -1,3 +1,20 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Special Mutable Schema interfaces.
+
+$Id$
+"""
 from zope.interface import Interface
 from zope.app.utilities.mutableschemafield \
      import MutableSchemaField, MutableSchemasField
@@ -6,18 +23,16 @@
     """An interface for content that can choose a mutable schema
     to be used for it"""
 
-    mutableschema = MutableSchemaField(title=u"Mutable Schema to use",
-                                       description=u"""Mutable Schema to use
-                                       as additional fields for this content
-                                       type"""
-                                       )
+    mutableschema = MutableSchemaField(
+        title=u"Mutable Schema to use",
+        description=u"""Mutable Schema to use as additional fields for """
+                    """this content type""")
 
 class IMutableSchemasContent(Interface):
     """An interface for content that can choose a mutable schema
     to be used for it"""
 
-    mutableschemas = MutableSchemasField(title=u"Mutable Schemas to use",
-                                       description=u"""Mutable Schemas to use
-                                       as additional fields for this content
-                                       type"""
-                                       )
+    mutableschemas = MutableSchemasField(
+        title=u"Mutable Schemas to use",
+        description=u"""Mutable Schemas to use as additional fields for """
+                    """this content type""")


=== Zope3/src/zope/app/utilities/mutableschemafield.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/utilities/mutableschemafield.py:1.1.2.1	Tue Aug 12 09:19:27 2003
+++ Zope3/src/zope/app/utilities/mutableschemafield.py	Wed Aug 13 09:20:44 2003
@@ -11,7 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
+"""Defines fields that are used in mutable schemas.
+
 $Id$
 """
 
@@ -35,7 +36,8 @@
         # XXX Workaround for None indicating a missing value
         if basetype is None:
             kw['required'] = False
-        super(MutableSchemaField, self).__init__(basetype=basetype, *args, **kw)
+        super(MutableSchemaField, self).__init__(basetype=basetype,
+                                                 *args, **kw)
 
     def _validate(self, value):
         basetype = self.basetype


=== Zope3/src/zope/app/utilities/schema.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/utilities/schema.py:1.1.2.2	Tue Aug 12 13:38:56 2003
+++ Zope3/src/zope/app/utilities/schema.py	Wed Aug 13 09:20:44 2003
@@ -1,25 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""TTW Schema (as Utility)
+
+$Id$
+"""
 from zope.app import zapi
-from zope.interface import implements
+from zope.app.browser.container.adding import Adding
+from zope.app.browser.form.editview import EditView
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.interfaces.utilities import ISchemaAdding
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.services.interface import PersistentInterfaceClass
 from zope.app.services.interface import PersistentInterface
 from zope.app.interfaces.utilities import IMutableSchema, ISchemaUtility
-from zope.schema import getFieldsInOrder, getFieldNamesInOrder
+from zope.interface import implements
 from zope.publisher.browser import BrowserView
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.app.browser.container.adding import Adding
-from zope.app.interfaces.utilities import ISchemaAdding
-from zope.app.browser.form.editview import EditView
+from zope.schema import getFieldsInOrder, getFieldNamesInOrder
 
 class SchemaUtility(PersistentInterfaceClass):
 
     implements(IMutableSchema, ISchemaUtility)
 
-    def __init__(self, name='SchemaUtility'):
-        super(SchemaUtility, self).__init__(name, (PersistentInterface,))
+    def __init__(self):
+        super(SchemaUtility, self).__init__('', (PersistentInterface,))
+
+    def setName(self, name):
+        """See zope.app.interfaces.utilities.IMutableSchema"""
+        self.__name__ = name
 
     def addField(self, name, field):
-        """Add a field to schema.
-        """
+        """See zope.app.interfaces.utilities.IMutableSchema"""
         fields = getFieldsInOrder(self)
         field_names = [n for n, f in fields]
         fields = [f for n, f in fields]
@@ -31,8 +52,7 @@
         self._p_changed = 1
 
     def removeField(self, name):
-        """Remove field from schema.
-        """
+        """See zope.app.interfaces.utilities.IMutableSchema"""
         fields = getFieldNamesInOrder(self)
         if name not in fields:
             raise KeyError, "Field %s does not exists." % name
@@ -40,8 +60,7 @@
         self._p_changed = 1
 
     def renameField(self, orig_name, target_name):
-        """Rename field.
-        """
+        """See zope.app.interfaces.utilities.IMutableSchema"""
         fields = getFieldNamesInOrder(self)
         if orig_name not in fields:
             raise KeyError, "Field %s does not exists." % orig_name
@@ -53,8 +72,7 @@
         self._p_changed = 1
 
     def insertField(self, name, field, position):
-        """Insert a field at position.
-        """
+        """See zope.app.interfaces.utilities.IMutableSchema"""
         fields = getFieldsInOrder(self)
         field_names = [n for n, f in fields]
         fields = [f for n, f in fields]
@@ -72,8 +90,7 @@
         self._p_changed = 1
 
     def moveField(self, name, position):
-        """Move field to position.
-        """
+        """See zope.app.interfaces.utilities.IMutableSchema"""
         fields = getFieldsInOrder(self)
         field_names = [n for n, f in fields]
         fields = [f for n, f in fields]




More information about the Zope3-Checkins mailing list