[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - IZMIViewService.py:1.1.2.3 ZMIViewUtility.py:1.1.2.8 metaConfigure.py:1.1.2.16 zmi-meta.zcml:1.1.2.8 zmi.zcml:1.1.2.10 StandardMacros.py:NONE
Jim Fulton
jim@zope.com
Fri, 7 Jun 2002 10:41:50 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/ZMI
Modified Files:
Tag: Zope-3x-branch
IZMIViewService.py ZMIViewUtility.py metaConfigure.py
zmi-meta.zcml zmi.zcml
Removed Files:
Tag: Zope-3x-branch
StandardMacros.py
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals):
- RenameAllowToRequire
- GroupClassRelatedDirectivesInClassDirective
- ViewInterfaceAndSimplification
- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes
- TwoArgumentViewConstructors
- ImplementsInZCML
- SimpleViewCreationInZCML
- RemoveGetView
- ReplaceProtectWithAllow
- ViewMethodsAsViews
- MergeProtectionAndComponentDefinitions
There were also various security fixes resulting of better integration
of security with components.
=== Zope3/lib/python/Zope/App/ZMI/IZMIViewService.py 1.1.2.2 => 1.1.2.3 ===
def getViews(object):
- """ return a sequence of tuples consisting of label, path for zmi
- management views of an object """
+ """Return UI views for an object
+
+ Return a sequence of tuples consisting of label, path for zmi
+ management views of an object """
-
\ No newline at end of file
+
=== Zope3/lib/python/Zope/App/ZMI/ZMIViewUtility.py 1.1.2.7 => 1.1.2.8 ===
from Zope.ComponentArchitecture.ContextDependent import ContextDependent
-from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
+from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.ComponentArchitecture import getService
from Zope.App.ZopePublication.PublicationTraverse \
import PublicationTraverser
from Zope.Exceptions import Unauthorized
-class ZMIViewUtility(ContextDependent):
+from Interface import Interface
- __implements__ = IBrowserPublisher
+class IZMIViewUtility(Interface):
+ def getZMIViews():
+ """Get available view information
- def setViewRequest(self, request):
- self.__request = request
+ Return a sequence of dictionaries with view labels and
+ actions, where actions are relative URLs.
+ """
+
+
+class ZMIViewUtility(BrowserView):
def getZMIViews(self):
- context = self.getContext()
+ context = self.context
zmi_view_service = getService(context, 'ZMIViewService')
zmi_views=[]
traverser = PublicationTraverser()
@@ -41,10 +47,10 @@
action=view[1]
if action:
try:
- traverser.traversePath(self.__request, context, action)
+ traverser.traversePath(self.request, context, action)
except Unauthorized:
continue # Skip unauthorized
- zmi_views.append({'label': label, 'action': "../%s" % action})
+ zmi_views.append({'label': label, 'action': "%s" % action})
return zmi_views
=== Zope3/lib/python/Zope/App/ZMI/metaConfigure.py 1.1.2.15 => 1.1.2.16 ===
$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,53 +41,36 @@
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_id, 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(",")])
+def ServiceClassDir(_context, id, class_, permission, title,
+ 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),
+ discriminator = ('AddableFactory', id),
callable = provideClass,
- args = ('AddableServices', name, _context.resolve(class_),
- permission_id, title, description, for_container,
+ args = ('AddableServices', id, _context.resolve(class_),
+ permission, title, description, for_container,
creation_markers)
)
]
-def ContentClassDir(_context, name, class_, permission_id, 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_id, title, description, for_container,
- creation_markers)
- )
- ]
=== Zope3/lib/python/Zope/App/ZMI/zmi-meta.zcml 1.1.2.7 => 1.1.2.8 ===
<directives namespace="http://namespaces.zope.org/zmi">
- <directive name="factoryFromClass"
- attributes="name, class, permission_id, 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" />
+ <subdirective name="tab" attributes="label action label" />
</directive>
- <directive name="icon" attributes="for, file, package, alt, layer"
+ <directive name="icon" attributes="for file package alt layer"
handler="Zope.App.ZMI.IconDirective." />
</directives>
<!-- Zope.App.ZMI.Service -->
<directives namespace="http://namespaces.zope.org/service">
<directive name="factoryFromClass"
- attributes="name, class, permission_id, title, description"
+ attributes="name class permission title description"
handler="Zope.App.ZMI.metaConfigure.ServiceClassDir" />
</directives>
=== Zope3/lib/python/Zope/App/ZMI/zmi.zcml 1.1.2.9 => 1.1.2.10 ===
>
- <serviceType name="ZMIViewService"
- interface=".IZMIViewService." />
+ <serviceType id="ZMIViewService"
+ interface=".IZMIViewService." />
- <service name="ZMIViewService"
- component=".ZMIViewService.ZMIViews" />
+ <service serviceType="ZMIViewService"
+ component=".ZMIViewService.ZMIViews" />
<browser:view name="standard_macros"
- factory=".StandardMacros." />
+ permission="Zope.View"
+ template="www/standard_macros.pt" />
<browser:view name="ZMIUtility"
+ permission="Zope.View"
+ allowed_interface=".ZMIViewUtility.IZMIViewUtility"
factory=".ZMIViewUtility." />
-
- <security:protectClass class=".StandardMacros."
- permission_id="Zope.View"/>
-
- <security:protectClass class=".ZMIViewUtility."
- permission_id="Zope.View"
- names="getZMIViews"/>
-
- <security:protectClass
- class=".IGenericCreatorMarker."
- interface=".IGenericCreatorMarker."
- permission_id="Zope.ManageContent" />
-
- <include package=".Views" file="views.zcml" />
+
+ <content class=".IGenericCreatorMarker.">
+ <security:require
+ permission="Zope.ManageContent"
+ interface=".IGenericCreatorMarker." />
+ </content>
+
+ <include package=".Views" file="views.zcml" />
</zopeConfigure>
=== Removed File Zope3/lib/python/Zope/App/ZMI/StandardMacros.py ===