[Zope3-checkins] CVS: Zope3/src/zope/app/registration/browser - __init__.py:1.6 changeregistrations.pt:1.2

Jim Fulton jim at zope.com
Thu Apr 8 17:03:10 EDT 2004


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

Modified Files:
	__init__.py changeregistrations.pt 
Log Message:
Removed the id key from info. Views can compute this if they want it.

Also, got rid of the keep_dummy option to info.  Clients didn't seem
to trust it anyway, so it did no good.  The info method doesn't return 
dummy entries (for the None stack marker) anymore,


=== Zope3/src/zope/app/registration/browser/__init__.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/registration/browser/__init__.py:1.5	Wed Mar 17 12:37:07 2004
+++ Zope3/src/zope/app/registration/browser/__init__.py	Thu Apr  8 17:02:40 2004
@@ -15,26 +15,24 @@
 
 $Id$
 """
-from zope.component import getView, getServiceManager
-from zope.proxy import removeAllProxies
-from zope.interface import implements
-
-from zope.app.publisher.browser import BrowserView
 from zope.app.container.browser.adding import Adding
-from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.container.interfaces import INameChooser
 from zope.app.form.browser import BrowserWidget, RadioWidget
 from zope.app.form.browser.interfaces import IBrowserWidget
 from zope.app.form.interfaces import IInputWidget
-from zope.app.container.interfaces import INameChooser
-
-from zope.app.registration.interfaces import IRegistration
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app import zapi
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.publisher.browser import BrowserView
+from zope.app.registration.interfaces import ActiveStatus
 from zope.app.registration.interfaces import IRegistered
-from zope.app.registration.interfaces import UnregisteredStatus
+from zope.app.registration.interfaces import IRegistration
 from zope.app.registration.interfaces import RegisteredStatus
-from zope.app.registration.interfaces import ActiveStatus
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.registration.interfaces import UnregisteredStatus
 from zope.app.traversing import getName, traverse
-
+from zope.component import getView, getServiceManager
+from zope.interface import implements
+from zope.proxy import removeAllProxies
 
 class RegistrationView(BrowserView):
 
@@ -115,7 +113,8 @@
                     message = _("Disabled")
             else:
                 for info in self.context.info():
-                    if info['id'] == id and not info['active']:
+                    infoid = zapi.getPath(info['registration'])
+                    if infoid == id and not info['active']:
                         self.context.activate(info['registration'])
                         message = _("Updated")
                         break
@@ -130,32 +129,26 @@
                                       'absolute_url', self.request)
                               )
 
-        registrations = self.context.info(True)
+        registrations = self.context.info()
 
         # This is OK because registrations is just a list of dicts
         registrations = removeAllProxies(registrations)
 
         inactive = 1
-        have_none = False
         for info in registrations:
             if info['active']:
                 inactive = None
             else:
-                info['active'] = None
+                info['active'] = False
 
             reg = info['registration']
-            if reg is not None:
-                info['summary'] = reg.implementationSummary()
-            else:
-                info['summary'] = ""
-                info['id'] = 'disable'
-                have_none = True
-
-        if not have_none:
-            # Add a dummy registration since the stack removes trailing None.
-            registrations.append({"active": False,
-                                  "id": "disable",
-                                  "summary": ""})
+            info['summary'] = reg.implementationSummary()
+            info['id'] = zpi.getPath(reg)
+            
+        # Add a dummy registration since the stack removes trailing None.
+        registrations.append({"active": False,
+                              "id": "disable",
+                              "summary": ""})
 
         self.inactive = inactive
         self.registrations = registrations


=== Zope3/src/zope/app/registration/browser/changeregistrations.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/registration/browser/changeregistrations.pt:1.1	Sat Mar 13 13:01:17 2004
+++ Zope3/src/zope/app/registration/browser/changeregistrations.pt	Thu Apr  8 17:02:40 2004
@@ -13,7 +13,7 @@
              />
      </td>
      <td tal:condition="python: registration['id'] != 'disable'"><a href="."
-            tal:attributes="href string:${view/configBase}/${registration/id}"
+            tal:attributes="href registration/registration/@@absolute_url"
             tal:content="registration/id"
          >foo/bar</a></td>
      <td tal:condition="python: registration['id'] == 'disable'"




More information about the Zope3-Checkins mailing list