Commit 75380c37 authored by Sebastien Robin's avatar Sebastien Robin

added a patch to make sure cell is available for default value

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 257f008d
No related merge requests found
...@@ -144,8 +144,29 @@ class ERP5Field(Field): ...@@ -144,8 +144,29 @@ class ERP5Field(Field):
psyco.bind(get_value) psyco.bind(get_value)
def _get_default(self, key, value, REQUEST):
if value is not None:
return value
try:
value = REQUEST.form[key]
except (KeyError, AttributeError):
# fall back on default
return self.get_value('default',REQUEST=REQUEST) # It was missing on Formulator
# if we enter a string value while the field expects unicode,
# convert to unicode first
# this solves a problem when re-rendering a sticky form with
# values from request
if (self.has_value('unicode') and self.get_value('unicode') and
type(value) == type('')):
return unicode(value, self.get_form_encoding())
else:
return value
# Dynamic Patch # Dynamic Patch
Field.get_value = ERP5Field.get_value Field.get_value = ERP5Field.get_value
Field._get_default = ERP5Field._get_default
Field.om_icons = ERP5Field.om_icons Field.om_icons = ERP5Field.om_icons
# Constructors # Constructors
......
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