[Checkins] SVN: zope.component/trunk/src/zope/component/_api.py Fixed a misleading comment and used hookable as a decorator because the code is easier to read that way.

Shane Hathaway shane at hathawaymix.org
Sat Jul 12 18:54:12 EDT 2008


Log message for revision 88305:
  Fixed a misleading comment and used hookable as a decorator because the code is easier to read that way.
  

Changed:
  U   zope.component/trunk/src/zope/component/_api.py

-=-
Modified: zope.component/trunk/src/zope/component/_api.py
===================================================================
--- zope.component/trunk/src/zope/component/_api.py	2008-07-12 22:41:25 UTC (rev 88304)
+++ zope.component/trunk/src/zope/component/_api.py	2008-07-12 22:54:12 UTC (rev 88305)
@@ -34,8 +34,11 @@
     def hookable(ob):
         return ob
 
-# SiteManager API. This needs to get deprecated eventually.
+# getSiteManager() returns a component registry.  Although the term
+# "site manager" is deprecated in favor of "component registry",
+# the old term is kept around to maintain a stable API.
 
+ at hookable
 def getSiteManager(context=None):
     if context is None:
         return base
@@ -47,8 +50,6 @@
         except TypeError, error:
             raise ComponentLookupError(*error.args)
 
-getSiteManager = hookable(getSiteManager)
-
 # Adapter API
 
 def getAdapterInContext(object, interface, context):
@@ -182,6 +183,7 @@
 # registry of the `zope.inteface` package. This way we will be able to call
 # interfaces to create adapters for objects. For example, `I1(ob)` is
 # equvalent to `getAdapterInContext(I1, ob, '')`.
+ at hookable
 def adapter_hook(interface, object, name='', default=None):
     try:
         sitemanager = getSiteManager()
@@ -190,9 +192,6 @@
         return None
     return sitemanager.queryAdapter(object, interface, name, default)
 
-# Make the component architecture's adapter hook hookable
-adapter_hook = hookable(adapter_hook)
-
 import zope.interface.interface
 zope.interface.interface.adapter_hooks.append(adapter_hook)
 #############################################################################



More information about the Checkins mailing list