diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2010-08-10 20:25:45 +0400 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2010-08-10 20:25:45 +0400 |
commit | 04c7b20c772f5078182bd5c435dac53304eea086 (patch) | |
tree | 62f4dcd1f0e0e461b55983cf51f2c0baf092e8b3 /src/common/dataforms.py | |
parent | f1e6e9245e121eedb955a39ee3b164c1e08b823c (diff) |
always send at least an emtpy <value> for every required fields when we send a dataform. Fixes #5829
Diffstat (limited to 'src/common/dataforms.py')
-rw-r--r-- | src/common/dataforms.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/dataforms.py b/src/common/dataforms.py index 6d9b46f9c..d1c82e589 100644 --- a/src/common/dataforms.py +++ b/src/common/dataforms.py @@ -352,7 +352,7 @@ class StringField(DataField): def fset(self, value): assert isinstance(value, basestring) - if value == '': + if value == '' and not self.required: return fdel(self) self.setTagData('value', value) @@ -662,6 +662,11 @@ class SimpleDataForm(DataForm, DataRecord): to_be_removed = [] for f in c.iter_fields(): if f.required: + # add <value> if there is not + if hasattr(f, 'value') and not f.value: + f.value = '' + if hasattr(f, 'values') and not f.values: + f.values = [''] # Keep all required fields continue if (hasattr(f, 'value') and not f.value) or (hasattr(f, 'values') \ |