Commit a7528c3a authored by Julien Muchembled's avatar Julien Muchembled

Fix ERP5Site.getSite on Zope 2.8

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39580 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 80333449
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment