[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - service.py:1.6.2.3

Guido van Rossum guido@python.org
Thu, 27 Feb 2003 20:43:58 -0500


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

Modified Files:
      Tag: use-config-branch
	service.py 
Log Message:
Checkpoint commit on this branch -- something's still flakey, but I
can't figure out why and I may not get back to this until Monday.

Redid the __init__ of ServiceConfiguration and its ancestors to get
rid of the unnecessary *args / **kwds business, and added an optional
context argument.  When context is given, it is used to traverse to
the service object and we ensure that it implements IUseConfigurable
and IService -- all configured services must implement these.  When
context is not given, we don't perform this check -- this only happens
in the test suite.

Fixed various places that need to pass a context argument, and fixed
some services to implement the required interfaces.



=== Zope3/src/zope/app/browser/services/service.py 1.6.2.2 => 1.6.2.3 ===
--- Zope3/src/zope/app/browser/services/service.py:1.6.2.2	Thu Feb 27 12:25:23 2003
+++ Zope3/src/zope/app/browser/services/service.py	Thu Feb 27 20:43:28 2003
@@ -48,11 +48,10 @@
             l = id.rfind('.')
             if l >= 0:
                 id = id[l+1:]
-            if id in self.context:
-                i=2
-                while ("%s-%s" % (id, i)) in self.context:
-                    i=i+1
-                id = "%s-%s" % (id, i)
+            i = 1
+            while ("%s-%s" % (id, i)) in self.context:
+                i=i+1
+            id = "%s-%s" % (id, i)
 
         # Call the superclass action() method.
         # As a side effect, self.added_object is set by add() above.
@@ -77,7 +76,7 @@
             # Build a configuration object for the service.
             configure = traverse(self.context, 'configure')
             container = getAdapter(configure, IZopeContainer)
-            sc = ServiceConfiguration(servicename, added_url)
+            sc = ServiceConfiguration(servicename, added_url, self.context)
             name = container.setObject("", sc)
             sc = container[name]
 
@@ -183,7 +182,7 @@
         return paths
 
     def action(self, service_type, component_path):
-        sd = ServiceConfiguration(service_type, component_path)
+        sd = ServiceConfiguration(service_type, component_path, self.request)
         sd = self.context.add(sd)
         getWidgetsDataForContent(self, IConfiguration, sd, strict=False)
         self.request.response.redirect(self.context.nextURL())