[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - metaConfigure.py:1.1.2.15.8.2 zmi-meta.zcml:1.1.2.7.2.3

Steve Alexander steve@cat-box.net
Mon, 3 Jun 2002 16:01:46 -0400


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

Modified Files:
      Tag: Zope3InWonderland-branch
	metaConfigure.py zmi-meta.zcml 
Log Message:
added content directive.


=== Zope3/lib/python/Zope/App/ZMI/metaConfigure.py 1.1.2.15.8.1 => 1.1.2.15.8.2 ===
 $Id$
 """
-
-
 from Zope.Configuration.Action import Action
 from Zope.ComponentArchitecture import getService
 from IGenericCreatorMarker import IGenericCreatorMarker
-from types import StringTypes
 from Zope.Security.Checker import NamesChecker, CheckerPublic, ProxyFactory
 from ClassFactory import ClassFactory
 
@@ -44,26 +41,31 @@
                                NamesChecker(('getInterfaces',),
                                             __call__=permission))
     getService(None, 'Factories').provideFactory(qualified_name, factory)
-    registry=getService(None,registry)
+    registry = getService(None, registry)
     registry.provideAddable(qualified_name, title, description,
                             for_container, creation_markers)
 
 
 def ServiceClassDir(_context, name, class_, permission, title,
-                    description='',
-                    for_container=None,
-                    creation_markers=IGenericCreatorMarker):
-    if type(for_container) in StringTypes:
-        for_container=tuple([_context.resolve(inter_name.strip()) for
-                       inter_name in for_container.split(",")])
-    if type(creation_markers) in StringTypes:
-        creation_markers=tuple([_context.resolve(inter_name.strip()) for
-                       inter_name in creation_markers.split(",")])
+                    description='', for_container='',
+                    creation_markers=''):
+    if for_container:
+        for_container = tuple([_context.resolve(cls)
+                               for cls in for_container.split()])
+    else:
+        for_container = None
+
+    if creation_markers:
+        creation_markers = tuple([_context.resolve(name)
+                                  for name in creation_markers.split()])
+    else:
+        creation_markers = (IGenericCreatorMarker,)
+        
+    # note factories are all in one pile, services and content,
+    # so addable names must also act as if they were all in the
+    # same namespace, despite the service/content division        
     return [
         Action(
-        # note factories are all in one pile, services and content,
-        # so addable names must also act as if they were all in the
-        # same namespace, despite the service/content division
             discriminator = ('AddableFactory', name),
             callable = provideClass,
             args = ('AddableServices', name, _context.resolve(class_),
@@ -72,25 +74,3 @@
              )
         ]
 
-def ContentClassDir(_context, name, class_, permission, title,
-                    description='',
-                    for_container=None,
-                    creation_markers=IGenericCreatorMarker):
-    if type(for_container) in StringTypes:
-        for_container=tuple([_context.resolve(inter_name.strip()) for
-                       inter_name in for_container.split(",")])
-    if type(creation_markers) in StringTypes:
-        creation_markers=tuple([_context.resolve(inter_name.strip()) for
-                       inter_name in creation_markers.split(",")])
-    return [
-        Action(
-        # note factories are all in one pile, services and content,
-        # so addable names must also act as if they were all in the
-        # same namespace, despite the service/content division
-            discriminator = ('AddableFactory', name),
-            callable = provideClass,
-            args = ('AddableContent', name, _context.resolve(class_),
-                    permission, title, description, for_container,
-                    creation_markers)
-            )
-        ]


=== Zope3/lib/python/Zope/App/ZMI/zmi-meta.zcml 1.1.2.7.2.2 => 1.1.2.7.2.3 ===
   <directives namespace="http://namespaces.zope.org/zmi">
 
-    <directive name="factoryFromClass"
-               attributes="name class permission title
-                           description creation_markers"
-               handler="Zope.App.ZMI.metaConfigure.ContentClassDir" />
-
     <directive name="tabs" attributes="for"
                handler="Zope.App.ZMI.TabsDirective.">
         <subdirective name="tab" attributes="label action label" />