[Erp5-report] r39750 nicolas.dumazet - /erp5/trunk/products/ERP5Type/Base.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Nov 2 02:14:51 CET 2010
Author: nicolas.dumazet
Date: Tue Nov 2 02:14:50 2010
New Revision: 39750
URL: http://svn.erp5.org?rev=39750&view=rev
Log:
Because we cache so much attribute lookups in local variables,
it is evil to recreate the attributes during _aq_reset.
Scenario:
* First call to aq_dynamic
* aq_portal_type = Base.aq_portal_type
- inner aq_dynamic business
- causing an aq_reset call
- Base.aq_portal_type = {}
- [...]
- return
* local aq_portal_type is not anymore Base.aq_portal_type
The symptoms are random, hard to reproduce loud KeyError crashes in
hasattr(aq_portal_type[aq_key], accessor_name, None)
that disappear on the second try.
Modified:
erp5/trunk/products/ERP5Type/Base.py
Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=39750&r1=39749&r2=39750&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Tue Nov 2 02:14:50 2010
@@ -290,8 +290,9 @@ class WorkflowMethod(Method):
self._invoke_always = {}
def _aq_reset():
- Base.aq_method_generated = set()
- Base.aq_portal_type = {}
+ # using clear to prevent changing the reference
+ Base.aq_method_generated.clear()
+ Base.aq_portal_type.clear()
Base.aq_related_generated = 0
try:
from Products.ERP5Form.PreferenceTool import PreferenceTool
More information about the Erp5-report
mailing list