[Erp5-report] r23756 - /erp5/trunk/products/ERP5Form/ProxyField.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 23 14:26:28 CEST 2008


Author: kazuhiko
Date: Tue Sep 23 14:26:04 2008
New Revision: 23756

URL: http://svn.erp5.org?rev=23756&view=rev
Log:
* fix the condition to make cache working.
* a small optimisation.

Modified:
    erp5/trunk/products/ERP5Form/ProxyField.py

Modified: erp5/trunk/products/ERP5Form/ProxyField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ProxyField.py?rev=23756&r1=23755&r2=23756&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ProxyField.py (original)
+++ erp5/trunk/products/ERP5Form/ProxyField.py Tue Sep 23 14:26:04 2008
@@ -441,11 +441,12 @@
       template_field = field.getTemplateField()
       if template_field.__class__ != ProxyField:
         break
-      if aq_base(template_field) in chain:
+      template_field_base = aq_base(template_field)
+      if template_field_base in chain:
         LOG('ProxyField', WARNING, 'Infinite loop detected in %s.' %
             '/'.join(self.getPhysicalPath()))
         return
-      chain.append(aq_base(template_field))
+      chain.append(template_field_base)
       field = template_field
     return template_field
 
@@ -691,9 +692,11 @@
     getTransactionalVariable(self)[self._getCacheId()] = field
 
   def _getTemplateFieldCache(self):
-    if self.aq_parent:
+    parent = self.aq_parent
+    if parent is not None:
+      return getTransactionalVariable(self)[self._getCacheId()].__of__(parent)
+    else:
       raise KeyError
-    return getTransactionalVariable(self)[self._getCacheId()].__of__(self.aq_parent)
 
 
 #




More information about the Erp5-report mailing list