Anyone against this change?

This change is needed because z3c.baseregistry does not work
otherwise. It registers everything in the global registry.
This is a blocker for us to move to ZTK 1.0.

Raise your hands until 28th October midnight UTC.
If noone objects until then, I'll merge to trunk and make a new

This is a forwarded message
From: Adam Groszer <agros...@gmail.com>
To: check...@zope.org
Date: Wednesday, October 27, 2010, 2:25:11 PM
Subject: [Checkins] SVN: zope.component/branches/adamg-fix-getSiteManager/ - 
Fix _api.getSiteManager in the way that it returns now

===8<==============Original message text===============
Log message for revision 117961:
  - Fix _api.getSiteManager in the way that it returns now
    globalregistry.getGlobalSiteManager() if context is None. What's anyway
    expected according to the docs.

  U   zope.component/branches/adamg-fix-getSiteManager/CHANGES.txt

Modified: zope.component/branches/adamg-fix-getSiteManager/CHANGES.txt
--- zope.component/branches/adamg-fix-getSiteManager/CHANGES.txt        
2010-10-27 12:11:58 UTC (rev 117960)
+++ zope.component/branches/adamg-fix-getSiteManager/CHANGES.txt        
2010-10-27 12:25:10 UTC (rev 117961)
@@ -4,7 +4,12 @@
 3.10.1 (unreleased)
-- Nothing changed yet.
+- Fix _api.getSiteManager in the way that it returns now
+  globalregistry.getGlobalSiteManager() if context is None. What's anyway
+  expected according to the docs.
+  Before it returned a cached local variable (which was init'ed with
+  globalregistry.base). This made z3c.baseregisty burp, because z3c.baseregisty
+  modifies globalregistry.globalSiteManager. Insane.
 3.10.0 (2010-09-25)

--- zope.component/branches/adamg-fix-getSiteManager/src/zope/component/_api.py 
2010-10-27 12:11:58 UTC (rev 117960)
+++ zope.component/branches/adamg-fix-getSiteManager/src/zope/component/_api.py 
2010-10-27 12:25:10 UTC (rev 117961)
@@ -39,14 +39,16 @@
 # 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.
-base = None
 def getSiteManager(context=None):
-    global base
     if context is None:
-        if base is None:
-            from zope.component.globalregistry import base
-        return base
+        # avoid cyclic import
+        # adhere to the doc and return the globalSiteManager,
+        # not some wannabe variable
+        # do not cache the value either, because at least z3c.baseregistry
+        # modifies it
+        from zope.component.globalregistry import getGlobalSiteManager
+        return getGlobalSiteManager()
         # Use the global site manager to adapt context to `IComponentLookup`
         # to avoid the recursion implied by using a local `getAdapter()` call.

checkins mailing list

===8<===========End of original message text===========

Best regards,
 Adam GROSZER                            mailto:agros...@gmail.com

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to