[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration - HookRegistry.py:1.1.2.2
Gary Poster
garyposter@earthlink.net
Wed, 17 Apr 2002 15:13:07 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Configuration
In directory cvs.zope.org:/tmp/cvs-serv31331/Configuration
Modified Files:
Tag: Zope-3x-branch
HookRegistry.py
Log Message:
This commit makes the following changes:
The hookable zcml mechanism now requires an intermediary method to overwrite: see the hookables in Zope.ComponentArchitecture for an example
IServiceService, Service, and ServiceManager now all have this signature for the getService method: name. They did use context, name. The context, name signature is still used for the main ComponentArchitecture getService function.
the getServiceDefinition function now requires context
A ServiceContainer returns a wrapped ServiceManager; a ServiceManager returns a wrapped Service.
ServiceManager now overrides two ComponentArchitecture hooks: getServiceManager and getNextServiceManager
getNextServiceManager and getNextService are two new ComponentArchitecture functions useful for placeful services
The Zope.Publisher.Browser.BrowserRequest now includes the Zope2 class definition of record: this means that the placeful RoleService is inching forward towards working.
tests have been updated to reflect these changes.
=== Zope3/lib/python/Zope/Configuration/HookRegistry.py 1.1.2.1 => 1.1.2.2 ===
raise DuplicationError(hname)
try:
- name.resolve(hname)
+ defaultimpl=name.resolve(hname)
except ImportError:
raise BadHookableError(
- "default hookable implementation cannot be found", hname)
+ "hookable %s cannot be found" % hname)
parent, last=self._getParentAndLast(hname)
+ implfunc="%s_hook" % last
+
+ if getattr(parent, implfunc, self) is self:
+ raise BadHookableError(
+ """default hookable implementation (%s) cannot be found;
+ note it must be in the same module as the hookable""" %
+ implfunc)
self._reg[hname]=0
@@ -84,7 +91,7 @@
parent, last=self._getParentAndLast(hookablename)
# set parent.last to implementation
- setattr(parent, last, implementation)
+ setattr(parent, "%s_hook" % last, implementation)
self._reg[hookablename]=hookname