[Checkins] SVN: zope.component/branches/tlotze-hooks/src/zope/component/ started a doc-test file for the hooks module

Thomas Lotze tl at gocept.com
Wed Oct 21 02:36:03 EDT 2009


Log message for revision 105189:
  started a doc-test file for the hooks module

Changed:
  A   zope.component/branches/tlotze-hooks/src/zope/component/hooks.txt
  U   zope.component/branches/tlotze-hooks/src/zope/component/tests.py

-=-
Added: zope.component/branches/tlotze-hooks/src/zope/component/hooks.txt
===================================================================
--- zope.component/branches/tlotze-hooks/src/zope/component/hooks.txt	                        (rev 0)
+++ zope.component/branches/tlotze-hooks/src/zope/component/hooks.txt	2009-10-21 06:36:02 UTC (rev 105189)
@@ -0,0 +1,23 @@
+==============================
+The current component registry
+==============================
+
+There can be any number of component registries in an application. One of them
+is the global component registry, and there is also the concept of a currently
+used component registry. Component registries other than the global one are
+associated with objects called sites. The ``zope.component.hooks`` module
+provides an API to set and access the current site as well as manipulate the
+adapter hook associated with it.
+
+As long as we haven't set a site, none is being considered current:
+
+>>> from zope.component.hooks import getSite
+>>> print getSite()
+None
+
+We can also ask for the current component registry (aka site manager
+historically); it will return the global one if no current site is set:
+
+>>> from zope.component.hooks import getSiteManager
+>>> getSiteManager()
+<BaseGlobalComponents base>


Property changes on: zope.component/branches/tlotze-hooks/src/zope/component/hooks.txt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Date
Added: svn:eol-style
   + native

Modified: zope.component/branches/tlotze-hooks/src/zope/component/tests.py
===================================================================
--- zope.component/branches/tlotze-hooks/src/zope/component/tests.py	2009-10-21 03:07:07 UTC (rev 105188)
+++ zope.component/branches/tlotze-hooks/src/zope/component/tests.py	2009-10-21 06:36:02 UTC (rev 105189)
@@ -1670,6 +1670,8 @@
         doctest.DocFileSuite('registry.txt', checker=checker,
                              setUp=setUpRegistryTests,
                              tearDown=tearDownRegistryTests),
+        doctest.DocFileSuite('hooks.txt',checker=checker,
+                             setUp=setUp, tearDown=tearDown),
         doctest.DocFileSuite('event.txt',
                              setUp=setUp, tearDown=tearDown),
         doctest.DocFileSuite('zcml.txt',checker=checker,



More information about the checkins mailing list