[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/service -
__init__.py:1.1.2.1
Jim Fulton
jim at zope.com
Mon Sep 8 15:22:00 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/services/service
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/browser/services/service
Modified Files:
Tag: parentgeddon-branch
__init__.py
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing. Specific log entries will be provided
when we merge this into the head.
=== Zope3/src/zope/app/browser/services/service/__init__.py 1.1 => 1.1.2.1 ===
--- Zope3/src/zope/app/browser/services/service/__init__.py:1.1 Tue Sep 2 16:45:56 2003
+++ Zope3/src/zope/app/browser/services/service/__init__.py Mon Sep 8 14:21:30 2003
@@ -19,7 +19,8 @@
from zope.app import zapi
from zope.app.browser.container.adding import Adding
from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.interfaces.container import IZopeContainer
+from zope.app.interfaces.container import IAddTarget, INameChooser
+from zope.app.interfaces.container import IRemoveSource
from zope.app.interfaces.services.registration import UnregisteredStatus
from zope.app.interfaces.services.registration import RegisteredStatus
from zope.app.interfaces.services.registration import ActiveStatus
@@ -37,8 +38,7 @@
def add(self, content):
# Override so as to save a reference to the added object
- self.added_object = zapi.ContextSuper(
- ComponentAdding, self).add(content)
+ self.added_object = super(ComponentAdding, self).add(content)
return self.added_object
def nextURL(self):
@@ -49,7 +49,7 @@
zapi.getView(self.added_object, 'absolute_url', self.request))
return url + "/@@addRegistration.html"
- return zapi.ContextSuper(ComponentAdding, self).nextURL()
+ return super(ComponentAdding, self).nextURL()
def action(self, type_name, id):
# For special case of that we want to redirect to another adding view
@@ -75,10 +75,7 @@
# Call the superclass action() method.
# As a side effect, self.added_object is set by add() above.
- zapi.ContextSuper(ComponentAdding, self).action(type_name, id)
-
- action = zapi.ContextMethod(action)
-
+ super(ComponentAdding, self).action(type_name, id)
class ServiceAdding(ComponentAdding):
"""Adding subclass used for adding services."""
@@ -91,7 +88,7 @@
if not ILocalService.isImplementedBy(content):
raise TypeError("%s is not a local service" % content)
- return zapi.ContextSuper(ServiceAdding, self).add(content)
+ return super(ServiceAdding, self).add(content)
class UtilityAdding(ComponentAdding):
@@ -104,7 +101,7 @@
# XXX This wants to be generalized!
if not ILocalUtility.isImplementedBy(content):
raise TypeError("%s is not a local utility" % content)
- return zapi.ContextSuper(UtilityAdding, self).add(content)
+ return super(UtilityAdding, self).add(content)
class AddServiceRegistration(BrowserView):
@@ -127,13 +124,14 @@
def action(self, name=[], active=[]):
path = zapi.name(self.context)
- configure = zapi.getWrapperContainer(
- self.context).getRegistrationManager()
- container = zapi.getAdapter(configure, IZopeContainer)
+ configure = self.context.__parent__.getRegistrationManager()
+ adder = zapi.getAdapter(configure, IAddTarget)
+ chooser = zapi.getAdapter(configure, INameChooser)
for nm in name:
sc = ServiceRegistration(nm, path, self.context)
- name = container.setObject("", sc)
+ name = chooser.chooseName(nm, sc)
+ name = adder.addObject(name, sc)
sc = container[name]
if nm in active:
sc.status = ActiveStatus
@@ -226,8 +224,8 @@
conf.status = UnregisteredStatus
parent = zapi.getParent(conf)
name = zapi.name(conf)
- container = zapi.getAdapter(parent, IZopeContainer)
- del container[name]
+ remover = zapi.getAdapter(parent, IRemoveSource)
+ remover.removeObject(name)
# 2) Delete the service objects
# XXX Jim doesn't like this very much; he thinks it's too much
@@ -240,8 +238,8 @@
for path, obj in services.items():
parent = zapi.getParent(obj)
name = zapi.name(obj)
- container = zapi.getAdapter(parent, IZopeContainer)
- del container[name]
+ remover = zapi.getAdapter(parent, IRemoveSource)
+ remover.removeObject(name)
s = _("Deleted: ${service_names}")
s.mapping = {'service_names': ", ".join(todo)}
More information about the Zope3-Checkins
mailing list