[Erp5-report] r39580 jm - /erp5/trunk/products/ERP5/ERP5Site.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 28 01:10:10 CEST 2010


Author: jm
Date: Thu Oct 28 01:10:09 2010
New Revision: 39580

URL: http://svn.erp5.org?rev=39580&view=rev
Log:
Fix ERP5Site.getSite on Zope 2.8

Modified:
    erp5/trunk/products/ERP5/ERP5Site.py

Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=39580&r1=39579&r2=39580&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Thu Oct 28 01:10:09 2010
@@ -180,6 +180,7 @@ class ReferCheckerBeforeTraverseHook:
             'request : "%s"' % http_url)
         response.unauthorized()
 
+import ZODB
 
 class _site(threading.local):
   """Class for getting and setting the site in the thread global namespace
@@ -190,13 +191,15 @@ class _site(threading.local):
     self = threading.local.__new__(cls)
     return self.__get, self.__set
 
-  def __get(self, REQUEST=None):
+  def __get(self, REQUEST=None,
+            # XXX Compatibility code (ZODB >= 3.9 has no __version__ anymore)
+            __opened='_opened'[getattr(ZODB, '__version__', '3.9') >= '3.9':]):
     """Returns the currently processed site, optionally wrapped in a request
     """
     while True:
       app, site_id = self.site[-1]
       app = app()
-      if app._p_jar.opened:
+      if getattr(app._p_jar, __opened):
         if REQUEST is None:
           return getattr(app, site_id)
         return getattr(app.__of__(RequestContainer(REQUEST=REQUEST)), site_id)




More information about the Erp5-report mailing list