Commit d078e422 authored by Yoshinori Okuji's avatar Yoshinori Okuji

The previous way was overkill.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17012 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 56a20d0c
...@@ -257,17 +257,20 @@ def get_value(self, id, **kw): ...@@ -257,17 +257,20 @@ def get_value(self, id, **kw):
if self._p_oid is None: if self._p_oid is None:
return self._original_get_value(id, **kw) return self._original_get_value(id, **kw)
cache_id = ('Form.get_value', if 1:
self._p_oid, value = getFieldValue(self, field, id, **kw)
field._p_oid, else:
id) cache_id = ('Form.get_value',
self._p_oid,
try: field._p_oid,
value = _field_value_cache[cache_id] id)
except KeyError:
# either returns non callable value (ex. "Title") try:
# or a FieldValue instance of appropriate class value = _field_value_cache[cache_id]
value = _field_value_cache[cache_id] = getFieldValue(self, field, id, **kw) except KeyError:
# either returns non callable value (ex. "Title")
# or a FieldValue instance of appropriate class
value = _field_value_cache[cache_id] = getFieldValue(self, field, id, **kw)
if callable(value): if callable(value):
return value(field, id, **kw) return value(field, id, **kw)
...@@ -304,7 +307,7 @@ def _get_default(self, key, value, REQUEST): ...@@ -304,7 +307,7 @@ def _get_default(self, key, value, REQUEST):
# Dynamic Patch # Dynamic Patch
original_get_value = Field.get_value original_get_value = Field.get_value
# Field.get_value = get_value Field.get_value = get_value
Field._original_get_value = original_get_value Field._original_get_value = original_get_value
Field._get_default = _get_default Field._get_default = _get_default
Field.om_icons = om_icons Field.om_icons = om_icons
......
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