[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser - Adding.py:1.2.6.1
Jim Fulton
jim@zope.com
Fri, 18 Oct 2002 10:22:30 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv1609/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser
Modified Files:
Tag: Zope3-Bangalore-TTW-Branch
Adding.py
Log Message:
Fixed a bug that occurred when adding TTW adapter services.
The service manager getService method ends up needin adapters to do
it's job. When getting the adapter service, thye get service code
called code that tried to get adapters and ended up needing to get the
adapter service, which caused an infinate recursion.
Added a fix that prevents a service manager from handling getService
requests while already servicing a getService request.
=== Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/Adding.py 1.2 => 1.2.6.1 ===
--- Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/Adding.py:1.2 Thu Jul 11 14:21:32 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/ServiceManager/Views/Browser/Adding.py Fri Oct 18 10:22:29 2002
@@ -24,4 +24,16 @@
menu_id = "add_component"
+ def action(self, type_name, id):
+ if not id:
+ # Generate an id from the type name
+ id = type_name
+ if id in self.context:
+ i=2
+ while ("%s-%s" % (id, i)) in self.context:
+ i=i+1
+ id = "%s-%s" % (id, i)
+ return super(ComponentAdding, self).action(type_name, id)
+
+
__doc__ = ComponentAdding.__doc__ + __doc__