Commit 111c142d authored by Jean-Paul Smets's avatar Jean-Paul Smets

Provide a chance to accessors to return default value whenever no default...

Provide a chance to accessors to return default value whenever no default value is defined on the field.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13606 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c687a93a
......@@ -120,7 +120,13 @@ def get_value(self, id, **kw):
form = self.aq_parent
ob = getattr(form, 'aq_parent', None)
key = self.id[3:]
if value not in (None, ''):
# If a default value is defined on the field, it has precedence
value = ob.getProperty(key, d=value)
else:
# else we should give a chance to the accessor to provide
# a default value (including None)
value = ob.getProperty(key)
except (KeyError, AttributeError):
value = None
# For the 'editable' value, we try to get a default value
......
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