[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - meta.zcml:1.18 metaconfigure.py:1.21 metadirectives.py:1.19 viewmeta.py:1.43 globalbrowsermenuservice.py:1.31

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 23 17:08:40 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv22597/src/zope/app/publisher/browser

Modified Files:
	meta.zcml metaconfigure.py metadirectives.py viewmeta.py 
	globalbrowsermenuservice.py 
Log Message:


Rip out usage everywhere.




=== Zope3/src/zope/app/publisher/browser/meta.zcml 1.17 => 1.18 ===
--- Zope3/src/zope/app/publisher/browser/meta.zcml:1.17	Mon Mar  1 05:52:45 2004
+++ Zope3/src/zope/app/publisher/browser/meta.zcml	Tue Mar 23 17:08:09 2004
@@ -151,12 +151,6 @@
         schema=".metadirectives.IAddMenuItemDirective"
         handler=".metaconfigure.addMenuItem"
         />
-    
-    <meta:directive
-        name="usage"
-        schema=".metadirectives.IUsageDirective"
-        handler=".metaconfigure.usage"
-        />
 
   </meta:directives>
 


=== Zope3/src/zope/app/publisher/browser/metaconfigure.py 1.20 => 1.21 ===
--- Zope3/src/zope/app/publisher/browser/metaconfigure.py:1.20	Mon Mar 15 15:41:51 2004
+++ Zope3/src/zope/app/publisher/browser/metaconfigure.py	Tue Mar 23 17:08:09 2004
@@ -18,7 +18,7 @@
 
 from zope.app import zapi
 from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.app.component.metaconfigure import skin, layer, usage
+from zope.app.component.metaconfigure import skin, layer
 from zope.app.component.metaconfigure import handler
 from zope.app.container.interfaces import IAdding
 from zope.app.publisher.browser.globalbrowsermenuservice \


=== Zope3/src/zope/app/publisher/browser/metadirectives.py 1.18 => 1.19 ===
--- Zope3/src/zope/app/publisher/browser/metadirectives.py:1.18	Sat Mar 20 14:52:46 2004
+++ Zope3/src/zope/app/publisher/browser/metadirectives.py	Tue Mar 23 17:08:09 2004
@@ -24,13 +24,12 @@
 from zope.app.security.fields import Permission
 
 from zope.app.component.metadirectives import IBasicViewInformation
-from zope.app.publisher.interfaces.browser import IUsage
 
 #
 # browser views
 #
 
-class IViewDirective(IBasicViewInformation, IUsage):
+class IViewDirective(IBasicViewInformation):
     """
     The view directive defines a view that has subpages.
 
@@ -154,7 +153,7 @@
 # browser pages
 #
 
-class IPagesDirective(IBasicViewInformation, IUsage):
+class IPagesDirective(IBasicViewInformation):
     """
     Define multiple pages without repeating all of the parameters.
 
@@ -221,7 +220,7 @@
         required=False
         )
 
-class IPageDirective(IPagesDirective, IPagesPageSubdirective, IUsage):
+class IPageDirective(IPagesDirective, IPagesPageSubdirective):
     """
     The page directive is used to create views that provide a single
     url or page.
@@ -370,7 +369,7 @@
 # browser menus
 #
 
-class IMenuDirective(IUsage):
+class IMenuDirective(Interface):
     """
     Define a browser menu
     """
@@ -505,16 +504,6 @@
     name = TextLine(
         title=u"Name",
         description=u"The name of the skin.",
-        required=True
-        )
-
-class IUsageDirective(Interface):
-    """Defines a view usage
-    """
-
-    name = TextLine(
-        title=u"Name",
-        description=u"The name of the usage.",
         required=True
         )
 


=== Zope3/src/zope/app/publisher/browser/viewmeta.py 1.42 => 1.43 ===
--- Zope3/src/zope/app/publisher/browser/viewmeta.py:1.42	Thu Mar 18 07:19:25 2004
+++ Zope3/src/zope/app/publisher/browser/viewmeta.py	Tue Mar 23 17:08:09 2004
@@ -96,15 +96,12 @@
          layer='default', template=None, class_=None,
          allowed_interface=None, allowed_attributes=None,
          attribute='__call__', menu=None, title=None, 
-         usage=u''
          ):
 
     try:
         s = zapi.getService(None, zapi.servicenames.Presentation)
     except ComponentLookupError, err:
         pass
-    else:
-        s.useUsage(usage)
 
     _handle_menu(_context, menu, title, [for_], name, permission)
 
@@ -139,8 +136,7 @@
         if template:
             # class and template
             new_class = SimpleViewClass(
-                template, bases=(class_, ), usage=usage
-                )
+                template, bases=(class_, ))
         else:
             if not hasattr(class_, 'browserDefault'):
                 cdict = {
@@ -154,14 +150,13 @@
             new_class = type(class_.__name__,
                              (class_, simple,),
                              cdict)
-            new_class.usage = usage
 
         if hasattr(class_, '__implements__'):
             classImplements(new_class, IBrowserPublisher)
 
     else:
         # template
-        new_class = SimpleViewClass(template, usage=usage)
+        new_class = SimpleViewClass(template)
 
     for n in (attribute, 'browserDefault', '__call__', 'publishTraverse'):
         required[n] = permission
@@ -182,13 +177,6 @@
                 IBrowserRequest, new_class, name, [for_], Interface, layer),
         )
 
-    if not usage and menu:
-        _context.action(
-            discriminator = None,
-            callable = _handle_usage_from_menu,
-            args = (new_class, menu, ),
-            )
-
 
 # pages, which are just a short-hand for multiple page directives.
 
@@ -203,13 +191,11 @@
     def __init__(self, _context, for_, permission,
                  layer='default', class_=None,
                  allowed_interface=None, allowed_attributes=None,
-                 usage=u''
                  ):
         self.opts = opts(for_=for_, permission=permission,
                          layer=layer, class_=class_,
                          allowed_interface=allowed_interface,
                          allowed_attributes=allowed_attributes,
-                         usage=usage
                          )
 
     def page(self, _context, name, attribute='__call__', template=None,
@@ -236,7 +222,7 @@
     def __init__(self, _context, for_, permission,
                  name='', layer='default', class_=None,
                  allowed_interface=None, allowed_attributes=None,
-                 menu=None, title=None, usage=u'', provides=Interface,
+                 menu=None, title=None, provides=Interface,
                  ):
 
         _handle_menu(_context, menu, title, [for_], name, permission)
@@ -247,12 +233,10 @@
                      allowed_interface, allowed_attributes)
 
         self.pages = []
-        # default usage is u''
-        self.usage = usage
         self.menu = menu
         self.provides = provides
 
-    def page(self, _context, name, attribute=None, template=None, usage=None):
+    def page(self, _context, name, attribute=None, template=None):
         if template:
             template = os.path.abspath(_context.path(template))
             if not os.path.isfile(template):
@@ -262,7 +246,7 @@
                 raise ConfigurationError(
                     "Must specify either a template or an attribute name")
 
-        self.pages.append((name, attribute, template, usage))
+        self.pages.append((name, attribute, template))
         return ()
 
     def defaultPage(self, _context, name):
@@ -278,19 +262,14 @@
         cdict = {}
         pages = {}
 
-        for pname, attribute, template, usage in self.pages:
-            if usage is None:
-                # If no usage is declared explicitly for this page, use the
-                # usage given for the whole view.
-                usage = self.usage
+        for pname, attribute, template in self.pages:
             try:
                 s = zapi.getService(None, zapi.servicenames.Presentation)
             except ComponentLookupError, err:
                 pass
-            else:
-                s.useUsage(usage)
+
             if template:
-                cdict[pname] = ViewPageTemplateFile(template, usage=usage)
+                cdict[pname] = ViewPageTemplateFile(template)
                 if attribute and attribute != name:
                     cdict[attribute] = cdict[pname]
             else:
@@ -384,14 +363,14 @@
 def addview(_context, name, permission,
             layer='default', class_=None,
             allowed_interface=None, allowed_attributes=None,
-            menu=None, title=None, usage=u'',
+            menu=None, title=None
             ):
     return view(_context, name,
                 'zope.app.container.interfaces.IAdding',
                 permission,
                 layer, class_,
                 allowed_interface, allowed_attributes,
-                menu, title, usage
+                menu, title
                 )
 
 def defaultView(_context, name, for_=None):
@@ -463,10 +442,6 @@
     if allowed_attributes:
         for name in allowed_attributes:
             required[name] = permission
-
-def _handle_usage_from_menu(view, menu_id):
-    usage = globalBrowserMenuService.getMenuUsage(menu_id)
-    view.usage = usage
 
 def _handle_for(_context, for_):
     if for_ is not None:


=== Zope3/src/zope/app/publisher/browser/globalbrowsermenuservice.py 1.30 => 1.31 ===
--- Zope3/src/zope/app/publisher/browser/globalbrowsermenuservice.py:1.30	Fri Mar  5 10:55:51 2004
+++ Zope3/src/zope/app/publisher/browser/globalbrowsermenuservice.py	Tue Mar 23 17:08:09 2004
@@ -39,10 +39,9 @@
 
     implements(IBrowserMenu)
 
-    def __init__(self, title, description=u'', usage=u''):
+    def __init__(self, title, description=u''):
         self.title = title
         self.description = description
-        self.usage = usage
         self.registry = TypeRegistry()
 
     def getMenuItems(self, object=None):
@@ -174,10 +173,6 @@
 
         return result
 
-    def getMenuUsage(self, menu_id):
-        return self._registry[menu_id].usage
-
-
     def getFirstMenuItem(self, menu_id, object, request):
         r = self.getMenu(menu_id, object, request, max=1)
         if r:
@@ -196,18 +191,14 @@
 
     _clear = __init__
 
-    def menu(self, menu_id, title, description=u'', usage=u''):
+    def menu(self, menu_id, title, description=u''):
         # XXX we have nothing to do with the title and description. ;)
 
         s = zapi.getService(None, zapi.servicenames.Presentation)
-        if not usage:
-            # usage could be None
-            usage = u''
-        s.useUsage(usage)
         if menu_id in self._registry:
             raise DuplicationError("Menu %s is already defined." % menu_id)
 
-        self._registry[menu_id] = Menu(title, description, usage)
+        self._registry[menu_id] = Menu(title, description)
 
     def menuItem(self, menu_id, interface, action, title,
                  description='', filter_string=None, permission=None,
@@ -234,11 +225,11 @@
         registry.register(interface, data)
 
 
-def menuDirective(_context, id, title, description='', usage=u''):
+def menuDirective(_context, id, title, description=''):
     _context.action(
         discriminator = ('browser:menu', id),
         callable = globalBrowserMenuService.menu,
-        args = (id, title, description, usage),
+        args = (id, title, description),
         )
 
 def menuItemDirective(_context, menu, for_,




More information about the Zope3-Checkins mailing list