[Erp5-report] r39576 jm - /erp5/trunk/products/ERP5/ERP5Site.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Oct 27 19:11:58 CEST 2010
Author: jm
Date: Wed Oct 27 19:11:57 2010
New Revision: 39576
URL: http://svn.erp5.org?rev=39576&view=rev
Log:
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.
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=39576&r1=39575&r2=39576&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Wed Oct 27 19:11:57 2010
@@ -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)
More information about the Erp5-report
mailing list