[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - hooks.py:1.1.2.21
Gary Poster
garyposter@earthlink.net
Wed, 3 Apr 2002 22:56:25 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv10125
Modified Files:
Tag: Zope-3x-branch
hooks.py
Log Message:
Component Architecture changes to allow factories to pass arguments; multiple touched files because of previous backwards merge and license script. I will check out after this to see if enough of my changes have gone through and I don't have to do a further mass check in.
=== Zope3/lib/python/Zope/ComponentArchitecture/hooks.py 1.1.2.20 => 1.1.2.21 ===
return provideFactory_hook(qname, factory)
-def createObject(place, name):
- return createObject_hook(place, name)
+def createObject(place, name, *args, **kwargs):
+ return createObject_hook(place, name, args, kwargs)
# default hooks
@@ -86,15 +86,13 @@
_verify(_IFactory, factory)
_factories[qname] = factory
-def createObject_hook(place, name):
+def createObject_hook(place, name, args=[], kwargs={}):
# XXX: place is ignored at present, as we don't yet
# have placeful factories
-
- try: factory = _factories[name]
+ try: return _factories[name](*args, **kwargs)
except KeyError:
raise ComponentLookupError(name)
- return factory()
def _clear():
global _adapters, _utilities, _factories