[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - Addable.py:1.1.2.4.10.1 provideClass.py:1.1.2.12.4.1 zmi-meta.zcml:1.1.2.3.10.1 zmi.zcml:1.1.2.5.4.1

Gary Poster garyposter@earthlink.net
Mon, 1 Apr 2002 14:25:02 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv28749

Modified Files:
      Tag: gary-pre_create_views-branch
	Addable.py provideClass.py zmi-meta.zcml zmi.zcml 
Log Message:
made standard Views directory structure and modified files to use it


=== Zope3/lib/python/Zope/App/ZMI/Addable.py 1.1.2.4 => 1.1.2.4.10.1 ===
 class Addables:
 
-    def provideAddable(self, id, title, description):
-        self.__reg.append(Addable(id, title, description))
+    def provideAddable(self, id, title, description, marker_interface=None):
+        self.__reg.append(Addable(id, title, description, marker_interface=marker_interface))
 
     def getAddables(self, ob):
         return self.__reg[:]
@@ -46,11 +46,13 @@
 
 class Addable:
 
-    def __init__(self, id, title, description, icon=None):
+    def __init__(self, id, title, description, icon=None, marker_interface=None):
         self.__id = id
         self.__title = title
         self.__description = description
         self.__icon = icon
+        if hasattr(self, "__implements__"): self.__implements__ = marker_interface, self.__implements__
+        else: self.__implements__=marker_interface
 
     def id(self): return self.__id
     def title(self): return self.__title


=== Zope3/lib/python/Zope/App/ZMI/provideClass.py 1.1.2.12 => 1.1.2.12.4.1 ===
 
 def provideClass(registry, qualified_name, _class, permission,
-                 title, description=''):
+                 title, description='',marker_interface=None):
     """Provide simple class setup
 
     - create a component
@@ -44,7 +44,7 @@
     """
     factory = ClassFactory(_class, permission)
     provideFactory(qualified_name, factory)
-    registry.provideAddable(qualified_name, title, description)
+    registry.provideAddable(qualified_name, title, description, marker_interface)
 
 def ServiceClassDir(_context, name, permission_id, title, description=''):
     return ((name,
@@ -53,12 +53,15 @@
               permission_id, title, description)
              ),)
 
+from Interface import Interface
+class GenericCreatorMarkerInterface(Interface):
+    ""
 
-def ContentClassDir(_context, name, permission_id, title, description=''):
+def ContentClassDir(_context, name, permission_id, title, description='', marker_interface=GenericCreatorMarkerInterface):
     return ((name,
              provideClass,
              (Addable.ContentAddables, name, _context.resolve(name),
-              permission_id, title, description)
+              permission_id, title, description, marker_interface)
              ),)
 
 


=== Zope3/lib/python/Zope/App/ZMI/zmi-meta.zcml 1.1.2.3 => 1.1.2.3.10.1 ===
 
     <directive name="factoryFromClass"
-               attributes="name, permission_id, title, description"
+               attributes="name, permission_id, title, description, marker_interface"
                handler="Zope.App.ZMI.provideClass.ContentClassDir" />
 
     <directive name="tabs" attributes="for"


=== Zope3/lib/python/Zope/App/ZMI/zmi.zcml 1.1.2.5 => 1.1.2.5.4.1 ===
                          methods="getZMIViews"/>
 
+  <security:protectClass 
+    name=".provideClass.GenericCreatorMarkerInterface"
+    interface=".provideClass.GenericCreatorMarkerInterface"
+    permission_id="Zope.Public"  />
 
 </zopeConfigure>