[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - metaConfigure.py:1.1.4.1 Addable.py:1.1.2.4.10.2 IZMIViewService.py:1.1.2.1.12.1 IconDirective.py:1.1.2.3.4.1 StandardMacros.py:1.1.2.2.10.1 TabsDirective.py:1.1.2.5.4.1 ZMIViewService.py:1.1.2.8.8.1 ZMIViewUtility.py:1.1.2.5.10.1 __init__.py:1.1.2.3.12.1 zmi-meta.zcml:1.1.2.3.10.2 zmi.zcml:1.1.2.5.4.3 provideClass.py:NONE

Gary Poster garyposter@earthlink.net
Tue, 2 Apr 2002 21:13:45 -0500


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

Modified Files:
      Tag: gary-pre_create_views-branch
	Addable.py IZMIViewService.py IconDirective.py 
	StandardMacros.py TabsDirective.py ZMIViewService.py 
	ZMIViewUtility.py __init__.py zmi-meta.zcml zmi.zcml 
Added Files:
      Tag: gary-pre_create_views-branch
	metaConfigure.py 
Removed Files:
      Tag: gary-pre_create_views-branch
	provideClass.py 
Log Message:
last commit bombed; trying again.

merged with Zope-3x branch (on my own branch; don't worry) to take advantage of Stephan's new code.  changed licenses with license utility (and thus five million commits).  Made a couple of presentational improvements.  Need to change job  board example to take advantage of this next.



=== Added File Zope3/lib/python/Zope/App/ZMI/metaConfigure.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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.
# 
##############################################################################
""" ZMI Addable Registration

$Id: metaConfigure.py,v 1.1.4.1 2002/04/03 02:13:14 poster Exp $
"""


from Zope.Configuration.Action import Action
from Zope.ComponentArchitecture.IFactory import IFactory
from Zope.ComponentArchitecture import provideFactory
import Addable
from IGenericCreatorMarker import IGenericCreatorMarker

class ClassFactory:
    __implements__ = IFactory

    def __init__(self, _class, permission):
        self.__permission__ = permission
        self._class = _class

    def __call__(self, *args, **kwargs):
        return self._class(*args, **kwargs)


def provideClass(registry, qualified_name, _class, permission,
                 title, description='', marker_interface=None):
    """Provide simple class setup

    - create a component

    - Register as addable

    - register a factory

    - set component permission
    """
    factory = ClassFactory(_class, permission)
    provideFactory(qualified_name, factory)
    registry.provideAddable(qualified_name, title, description, marker_interface)


def ServiceClassDir(_context, name, class_, permission_id, title,
                    description=''):
    return [
        Action(
            discriminator = name,
            callable = provideClass,
            args = (Addable.ServiceAddables, name, _context.resolve(class_),
                    permission_id, title, description)
             )
        ]

def ContentClassDir(_context, name, class_, permission_id, title,
                    description='',
		    marker_interface=IGenericCreatorMarker):
    if marker_interface is not IGenericCreatorMarker:
        marker_interface=_context.resolve(marker_interface)
    return [
        Action(
            discriminator = name,
            callable = provideClass,
            args = (Addable.ContentAddables, name, _context.resolve(class_),
                    permission_id, title, description, marker_interface)
            )
        ]


=== Zope3/lib/python/Zope/App/ZMI/Addable.py 1.1.2.4.10.1 => 1.1.2.4.10.2 ===
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2001, 2002 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
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """
@@ -51,8 +52,11 @@
         self.__title = title
         self.__description = description
         self.__icon = icon
-        if hasattr(self, "__implements__"): self.__implements__ = marker_interface, self.__implements__
-        else: self.__implements__=marker_interface
+        if marker_interface:
+            if hasattr(self, "__implements__"): 
+                # not checking to see if already there...
+                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/IZMIViewService.py 1.1.2.1 => 1.1.2.1.12.1 ===
+#
+# Copyright (c) 2001, 2002 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.
+# 
+##############################################################################
 from Interface import Interface     
 
 class IZMIViewService(Interface):


=== Zope3/lib/python/Zope/App/ZMI/IconDirective.py 1.1.2.3 => 1.1.2.3.4.1 ===
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2001, 2002 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
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/App/ZMI/StandardMacros.py 1.1.2.2 => 1.1.2.2.10.1 ===
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2001, 2002 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
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/App/ZMI/TabsDirective.py 1.1.2.5 => 1.1.2.5.4.1 ===
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2001, 2002 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
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/App/ZMI/ZMIViewService.py 1.1.2.8 => 1.1.2.8.8.1 ===
+#
+# Copyright (c) 2001, 2002 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.
+# 
+##############################################################################
 from IZMIViewService import IZMIViewService
 from Interface.Implements import objectImplements, flattenInterfaces
 
@@ -70,11 +83,11 @@
         '''
 
         data = {
-            'here':         object,
-            'container':    getinnercontext(object),
-            'nothing':      None,
-        #    'request':      getattr( object, 'REQUEST', None ),
-            'user':         getSecurityManager().getPrincipal(),
+            'context': object,
+            'view': getinnercontext(object),
+            'nothing': None,
+        #    'request': getattr( object, 'REQUEST', None ),
+            'user': getSecurityManager().getPrincipal(),
             }
         return getEngine().getContext(data)
 


=== Zope3/lib/python/Zope/App/ZMI/ZMIViewUtility.py 1.1.2.5 => 1.1.2.5.10.1 ===
 #
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2001, 2002 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
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/App/ZMI/__init__.py 1.1.2.3 => 1.1.2.3.12.1 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
 # This software is subject to the provisions of the Zope Public License,
-# Version 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# 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 
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-
+# 
+##############################################################################
 """ Zope Management Interface """
 
-from provideClass import provideClass
+from metaConfigure import provideClass


=== Zope3/lib/python/Zope/App/ZMI/zmi-meta.zcml 1.1.2.3.10.1 => 1.1.2.3.10.2 ===
   <directives namespace="http://namespaces.zope.org/zmi">
 
-    <!-- provideClass needs to be deprecated -->
-    <directive name="provideClass"
-               attributes="name, permission_id, title, description"
-               handler="Zope.App.ZMI.provideClass.ContentClassDir" />
-
     <directive name="factoryFromClass"
-               attributes="name, permission_id, title, description, marker_interface"
-               handler="Zope.App.ZMI.provideClass.ContentClassDir" />
+               attributes="name, class, permission_id, title, description, marker_interface"
+               handler="Zope.App.ZMI.metaConfigure.ContentClassDir" />
 
     <directive name="tabs" attributes="for"
                handler="Zope.App.ZMI.TabsDirective.">
@@ -23,9 +18,9 @@
 
   <!-- Zope.App.ZMI.Service -->
   <directives namespace="http://namespaces.zope.org/service">
-   	 <directive name="provideClass"
-               attributes="name, permission_id, title, description"
-               handler="Zope.App.ZMI.provideClass.ServiceClassDir" />
+   	 <directive name="factoryFromClass"
+               attributes="name, class, permission_id, title, description"
+               handler="Zope.App.ZMI.metaConfigure.ServiceClassDir" />
 
   </directives>
 


=== Zope3/lib/python/Zope/App/ZMI/zmi.zcml 1.1.2.5.4.2 => 1.1.2.5.4.3 ===
 
   <security:protectClass 
-    name=".provideClass.GenericCreatorMarkerInterface"
-    interface=".provideClass.GenericCreatorMarkerInterface"
-    permission_id="Zope.Public"  />
+    name=".IGenericCreatorMarker."
+    interface=".IGenericCreatorMarker."
+    permission_id="Zope.ManageContent"  />
     
     <include package=".Views" file="views.zcml" />
 

=== Removed File Zope3/lib/python/Zope/App/ZMI/provideClass.py ===