[Zope3-checkins] CVS: Zope3/src/zope/app/site/browser - tools.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Apr 17 10:33:39 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/site/browser
In directory cvs.zope.org:/tmp/cvs-serv16936/src/zope/app/site/browser
Modified Files:
tools.py
Log Message:
Get rid of getRegisteredMatching().
Use Utilities object instead of string.
=== Zope3/src/zope/app/site/browser/tools.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/site/browser/tools.py:1.4 Tue Apr 6 04:34:07 2004
+++ Zope3/src/zope/app/site/browser/tools.py Sat Apr 17 10:33:38 2004
@@ -21,9 +21,10 @@
from zope.app.pagetemplate.simpleviewclass import simple as SimpleView
from zope.app.publisher.interfaces.browser import IBrowserView
from zope.app import zapi
+from zope.app.copypastemove import rename
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.site.folder import SiteManagementFolder
-from zope.app.servicenames import Services
+from zope.app.servicenames import Services, Utilities
from zope.app.utility.browser import AddRegistration
from zope.app.utility import UtilityRegistration
from zope.app.site.browser import ComponentAdding
@@ -32,7 +33,6 @@
from zope.app.registration.interfaces import RegisteredStatus
from zope.app.registration.interfaces import ActiveStatus
from zope.app.site.interfaces import ILocalService
-from zope.app.copypastemove import rename
from zope.app.site.browser import ServiceAdding
from zope.app.i18n import ZopeMessageIDFactory as _
@@ -232,7 +232,7 @@
def delete(self):
for name in self.request.form['selected']:
- utils = zapi.getService(self, 'Utilities')
+ utils = zapi.getService(self, Utilities)
reg = utils.queryRegistrations(name, self.interface)
del_objs = []
@@ -318,19 +318,20 @@
return status
def getComponents(self):
- utils = zapi.getService(self.context, 'Utilities')
+ utils = zapi.getService(self.context, Utilities)
items = []
- for iface, reg_name, stack in \
- utils.getRegisteredMatching(self.interface):
- info = stack.info()
- component = info[0]['registration'].getComponent()
- parent = zapi.getParent(component)
+ for registration in [reg for reg in utils.registrations(localOnly=True)
+ if reg.provided == self.interface]:
+
+ stack = utils.queryRegistrationsFor(registration)
+ parent = zapi.getParent(registration.component)
items.append({
- 'name': reg_name,
- 'url': zapi.getPath(component),
+ 'name': registration.name,
+ 'url': zapi.getPath(registration.component),
'parent_url': zapi.getPath(parent),
'parent_name': zapi.name(parent),
'active': stack.active()})
+
return items
More information about the Zope3-Checkins
mailing list