diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py
index 792680ce655415a3156d78f4833463142930bb48..8c8df3588c62340e1a1b66a958846b737d32794d 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)