Commit 439e447a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

set parent field id in REQUEST in any case.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23810 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7cb0b557
...@@ -407,22 +407,19 @@ class ProxyField(ZMIField): ...@@ -407,22 +407,19 @@ class ProxyField(ZMIField):
""" """
return self.getTemplateField().get_error_names() return self.getTemplateField().get_error_names()
def getTemplateField(self, cache='auto'): def getTemplateField(self, cache=True):
""" """
Return template field of the proxy field. Return template field of the proxy field.
""" """
if cache == 'auto': if cache is True:
tales = self.tales tales = self.tales
if self._p_oid is None or tales['field_id'] or tales['form_id']: if self._p_oid is None or tales['field_id'] or tales['form_id']:
cache = False cache = False
else: else:
cache = True try:
return self._getTemplateFieldCache()
if cache is True: except KeyError:
try: pass
return self._getTemplateFieldCache()
except KeyError:
pass
form = self.aq_parent form = self.aq_parent
object = form.aq_parent object = form.aq_parent
...@@ -652,17 +649,8 @@ class ProxyField(ZMIField): ...@@ -652,17 +649,8 @@ class ProxyField(ZMIField):
(not self.is_delegated(id))): (not self.is_delegated(id))):
return ZMIField.get_value(self, id, **kw) return ZMIField.get_value(self, id, **kw)
# Don't use cache if field is not stored in zodb, or if target field is
# defined by a TALES
if self._p_oid is None or self.tales['field_id'] or self.tales['form_id']:
proxy_field = self.getTemplateField(cache=False)
if proxy_field is not None:
return proxy_field.get_value(id, **kw)
else:
return None
field = self field = self
proxy_field = self.getTemplateField(cache=True) proxy_field = self.getTemplateField()
REQUEST = get_request() REQUEST = get_request()
if proxy_field is not None and REQUEST is not None: if proxy_field is not None and REQUEST is not None:
field = REQUEST.get( field = REQUEST.get(
...@@ -672,6 +660,16 @@ class ProxyField(ZMIField): ...@@ -672,6 +660,16 @@ class ProxyField(ZMIField):
'field__proxyfield_%s_%s_%s' % (proxy_field.id, proxy_field._p_oid, id), 'field__proxyfield_%s_%s_%s' % (proxy_field.id, proxy_field._p_oid, id),
field) field)
# Don't use cache if field is not stored in zodb, or if target field is
# defined by a TALES
if self._p_oid is None or self.tales['field_id'] or self.tales['form_id']:
return self._get_value(id, **kw)
proxy_field = self.getTemplateField(cache=False)
if proxy_field is not None:
return proxy_field.get_value(id, **kw)
else:
return None
cache_id = ('ProxyField.get_value', cache_id = ('ProxyField.get_value',
self._p_oid, self._p_oid,
field._p_oid, field._p_oid,
...@@ -694,7 +692,7 @@ class ProxyField(ZMIField): ...@@ -694,7 +692,7 @@ class ProxyField(ZMIField):
return value return value
def _get_value(self, id, **kw): def _get_value(self, id, **kw):
proxy_field = self.getTemplateField() proxy_field = self.getTemplateField(cache=False)
if proxy_field is not None: if proxy_field is not None:
return proxy_field.get_value(id, **kw) return proxy_field.get_value(id, **kw)
......
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