Commit 0cf5e636 authored by Julien Muchembled's avatar Julien Muchembled

Make ERP5Site.getSite detect closed connection to ZODB

This fixes unit tests using 'ERP5TypeTestCase.publish' method:
in this case, a second connection is open and closed to process the request.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39576 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 19e5f154
......@@ -193,10 +193,14 @@ class _site(threading.local):
def __get(self, REQUEST=None):
"""Returns the currently processed site, optionally wrapped in a request
"""
app, site_id = self.site[-1]
if REQUEST is None:
return getattr(app(), site_id)
return getattr(app().__of__(RequestContainer(REQUEST=REQUEST)), site_id)
while True:
app, site_id = self.site[-1]
app = app()
if app._p_jar.opened:
if REQUEST is None:
return getattr(app, site_id)
return getattr(app.__of__(RequestContainer(REQUEST=REQUEST)), site_id)
del self.site[-1]
def __set(self, site):
app = aq_base(site.aq_parent)
......
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