[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/registration - __init__.py:1.19 configure.zcml:1.12

Jim Fulton jim at zope.com
Sun Mar 7 08:54:14 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/browser/services/registration
In directory cvs.zope.org:/tmp/cvs-serv953/src/zope/app/browser/services/registration

Modified Files:
	__init__.py configure.zcml 
Log Message:
Got rid of the unused NameComponentRegistry view

Renamed NameRegistered, which doesn't really use names, to Registered.


=== Zope3/src/zope/app/browser/services/registration/__init__.py 1.18 => 1.19 ===
--- Zope3/src/zope/app/browser/services/registration/__init__.py:1.18	Sun Mar  7 06:50:36 2004
+++ Zope3/src/zope/app/browser/services/registration/__init__.py	Sun Mar  7 08:54:13 2004
@@ -36,50 +36,6 @@
 from zope.interface import implements
 
 
-class NameRegistryView(BrowserView):
-
-    indexMacros = index = ViewPageTemplateFile('nameregistry.pt')
-
-    def update(self):
-
-        names = list(self.context.listRegistrationNames())
-        names.sort()
-
-        items = []
-        for name in names:
-            registry = self.context.queryRegistrations(name)
-            view = getView(registry, "ChangeRegistrations", self.request)
-            view.setPrefix(name)
-            view.update()
-            cfg = registry.active()
-            items.append(self._getItem(name, view, cfg))
-
-        return items
-
-    def _getItem(self, name, view, cfg):
-        # hook for subclasses. returns a dict to append to an item
-        return {"name": name,
-                "active": cfg is not None,
-                "inactive": cfg is None,
-                "view": view,
-                }
-
-
-class NameComponentRegistryView(NameRegistryView):
-
-    indexMacros = index = ViewPageTemplateFile('namecomponentregistry.pt')
-
-    def _getItem(self, name, view, cfg):
-        item_dict = NameRegistryView._getItem(self, name, view, cfg)
-        if cfg is not None:
-            ob = traverse(cfg, cfg.componentPath)
-            url = str(getView(ob, 'absolute_url', self.request))
-        else:
-            url = None
-        item_dict['url'] = url
-        return item_dict
-
-
 class RegistrationView(BrowserView):
 
     def __init__(self, context, request):
@@ -115,7 +71,7 @@
         return self.registrations[0]
 
 
-class NameRegistered:
+class Registered:
 
     def __init__(self, context, request):
         self.context = context
@@ -127,23 +83,12 @@
         result = []
         for path in useconfig.usages():
             config = traverse(component, path)
-            description = None
-            summaryMethod = getattr(config, "usageSummary", None)
-            if summaryMethod:
-                description = summaryMethod()
+            description = config.usageSummary()
             url = getView(config, 'absolute_url', self.request)
-            # XXX This assumes the registration implements
-            #     INamedComponentRegistration rather than just
-            #     IComponentRegistration.  ATM there are no
-            #     counterexamples, so this is a sleeper bug;
-            #     but what to do?  Could move the registration
-            #     management up to INamedComponentRegistration,
-            #     or could use path as default for name here.
-            result.append({'name': config.name,
-                           'path': path,
+            result.append({'path': path,
                            'url': url(),
                            'status': config.status,
-                           'description': description or config.name,
+                           'description': description,
                            })
         return result
 


=== Zope3/src/zope/app/browser/services/registration/configure.zcml 1.11 => 1.12 ===
--- Zope3/src/zope/app/browser/services/registration/configure.zcml:1.11	Sat Mar  6 17:07:24 2004
+++ Zope3/src/zope/app/browser/services/registration/configure.zcml	Sun Mar  7 08:54:13 2004
@@ -19,13 +19,6 @@
                    "zope.app.browser.interfaces.form.IFormCollaborationView"
       permission="zope.ManageServices" />
 
-  <page
-      name="index.html" 
-      for="zope.app.interfaces.services.registration.INameComponentRegistry"
-      class=".NameComponentRegistryView"
-      permission="zope.ManageServices"
-      attribute="index" />
-
   <zope:view
       for="zope.app.interfaces.services.registration.IComponentPath"
       type="zope.publisher.interfaces.browser.IBrowserRequest"
@@ -88,7 +81,7 @@
       for="zope.app.interfaces.services.registration.IRegisterable"
       name="registrations.html"
       template="registered.pt"
-      class=".NameRegistered"
+      class=".Registered"
       permission="zope.ManageServices"
       usage="objectview"
       />




More information about the Zope3-Checkins mailing list