From a7528c3a54b6def2b977cf1c1366c06772334dde Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Wed, 27 Oct 2010 23:10:09 +0000 Subject: [PATCH] Fix ERP5Site.getSite on Zope 2.8 git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39580 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/ERP5Site.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py index 792680ce65..8c8df3588c 100644 --- a/product/ERP5/ERP5Site.py +++ b/product/ERP5/ERP5Site.py @@ -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) -- 2.30.9