[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/utilities - __init__.py:1.2 content.py:1.2 schema.py:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Aug 15 21:45:10 EDT 2003


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

Added Files:
	__init__.py content.py schema.py 
Log Message:
Merging dreamcatcher's TTW Schema branch:

1. Fixed Bug in adding that would cause infinite loops when the menu items
   action was not a valif view or factory id.

2. Extended adding to support more complex views. Until now we only 
   supported constructions like "+/AddView=id". Now you are able to say
   "+/AddView/More=id", which means that more information can be carried 
   in the URL. This can be used in many ways, including multi-page adding
   wizards. In my case I needed it to pass in the type of the TTW Schema-
   based Content Component.

3. Added Local Menus. This was a pain in the butt, but I think I got a 
   fairly nice model, where you can create local Menu Services, and Menus
   are simply named utilities. When active they are menus in the menu 
   service. This is very similar to the local interface service and TTW 
   Schema. 

4. Made some modifications to TTW Schema, cleaned up the code and moved
   the browser code and interfaces to the places they belong.

5. Added a Content Component Definition utility component, which takes a
   Schema and creates a content component for it, including permission
   settings and a menu entry. Currently the menu entry is always made to
   a local 'add_content' menu. I will change this and make it actually a
   screen, where the menu and title of the menu item can be chosen by the
   developer. Mmmh, should I add a factory for the definition as well, so
   that the content component is also available via python?

6. Added a Content Component Instance component that represents an 
   instance od a Content Component Definition. You will never directly 
   encounter this component, since it is automatically used by the adding
   code of the Content Component Definition.

7. Cleanups by both dreamcatcher and myself.

That's it. For more details see the branch checkin messages. I now consider
the dreamcatcher-ttwschema-branch closed.


=== Zope3/src/zope/app/interfaces/utilities/__init__.py 1.1 => 1.2 ===


=== Zope3/src/zope/app/interfaces/utilities/content.py 1.1 => 1.2 ===
--- /dev/null	Fri Aug 15 20:45:10 2003
+++ Zope3/src/zope/app/interfaces/utilities/content.py	Fri Aug 15 20:43:34 2003
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Content Component Definition and Instance Interfaces
+
+$Id$
+"""
+from zope.interface import Interface, Attribute
+from zope.schema import TextLine
+from zope.app.component.interfacefield import InterfaceField
+
+
+class IContentComponentDefinition(Interface):
+    """Content Component Definitions describe simple single-schema based
+    content components including their security declarations."""
+
+    name = TextLine(
+        title=u"Name of Content Component Type",
+        description=u"""This is the name of the document type.""",
+        required=True)
+
+    schema = InterfaceField(
+        title=u"Schema",
+        description=u"Specifies the schema that characterizes the document.",
+        required=True)
+
+    permissions = Attribute(
+        u"A dictionary that maps set/get permissions on the schema's"
+        u"fields. Entries looks as follows: {fieldname:(set_perm, get_perm)}")
+
+
+class IContentComponentInstance(Interface):
+    """Interface describing a Content Component Instance"""
+
+    __name__ = TextLine(
+        title=u"Name of Content Component Type",
+        description=u"""This is the name of the document type.""",
+        required=True)
+
+    __schema__ = InterfaceField(
+        title=u"Schema",
+        description=u"Specifies the schema that characterizes the document.",
+        required=True)


=== Zope3/src/zope/app/interfaces/utilities/schema.py 1.1 => 1.2 ===
--- /dev/null	Fri Aug 15 20:45:10 2003
+++ Zope3/src/zope/app/interfaces/utilities/schema.py	Fri Aug 15 20:43:34 2003
@@ -0,0 +1,75 @@
+##############################################################################
+#
+# 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 Interfaces
+
+$Id$
+"""
+from zope.interface import Interface, Attribute
+from zope.interface.interfaces import IInterface
+from zope.schema import TextLine
+from zope.app.interfaces.container import IAdding
+from zope.app.interfaces.component import IInterfaceField, IInterfacesField
+
+class ISchemaUtility(Interface):
+    pass
+
+class ISchemaAdding(IAdding):
+    pass
+
+class IMutableSchema(IInterface):
+    """This object represents an interface/schema that can be edited by
+    managing the fields it contains."""
+
+    def getName(name):
+        """Get the name of the schema."""
+
+    def setName(name):
+        """Set the name of the schema."""
+
+    def addField(name, field):
+        """Add a field to schema."""
+
+    def removeField(name):
+        """Remove field by name from the schema.
+
+        If the field does not exist, raise an error.
+        """
+
+    def renameField(orig_name, target_name):
+        """Rename a field.
+
+        If the target_name is already taken, raise an error.
+        """
+
+    def insertField(name, field, position):
+        """Insert a field with a given name at the specified position.
+
+        If the position does not make sense, i.e. a negative number of a
+        number larger than len(self), then an error is raised.
+        """
+
+    def moveField(name, position):
+        """Move a field (given by its name) to a particular position.
+
+        If the position does not make sense, i.e. a negative number of a
+        number larger than len(self), then an error is raised.
+        """
+
+class IMutableSchemaField(IInterfaceField):
+    """A type of Field that has an IMutableSchema as its value."""
+
+class IMutableSchemasField(IInterfaceField):
+    """A type of Field that has a tuple of IMutableSchemas as its value."""
+
+




More information about the Zope3-Checkins mailing list