Commit cf596c78 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* fix the condition to make cache working.

* a small optimisation.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23756 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1d208b8a
...@@ -441,11 +441,12 @@ class ProxyField(ZMIField): ...@@ -441,11 +441,12 @@ class ProxyField(ZMIField):
template_field = field.getTemplateField() template_field = field.getTemplateField()
if template_field.__class__ != ProxyField: if template_field.__class__ != ProxyField:
break 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.' % LOG('ProxyField', WARNING, 'Infinite loop detected in %s.' %
'/'.join(self.getPhysicalPath())) '/'.join(self.getPhysicalPath()))
return return
chain.append(aq_base(template_field)) chain.append(template_field_base)
field = template_field field = template_field
return template_field return template_field
...@@ -691,9 +692,11 @@ class ProxyField(ZMIField): ...@@ -691,9 +692,11 @@ class ProxyField(ZMIField):
getTransactionalVariable(self)[self._getCacheId()] = field getTransactionalVariable(self)[self._getCacheId()] = field
def _getTemplateFieldCache(self): 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 raise KeyError
return getTransactionalVariable(self)[self._getCacheId()].__of__(self.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