# HG changeset patch # User Sylvain Thénault # Date 1264582753 -3600 # Node ID 91a56a30141eff5c88e225e8804e8419d87b1883 # Parent bd8480824e0bc4e9851b79e71e4cb6dc2b2c40c7 by default this is not the widget responsability to turn empty string into None, move this behaviour to the field. diff -r bd8480824e0b -r 91a56a30141e web/formfields.py --- a/web/formfields.py Wed Jan 27 09:57:53 2010 +0100 +++ b/web/formfields.py Wed Jan 27 09:59:13 2010 +0100 @@ -359,7 +359,7 @@ correctly typed objects, but process_for_value must return a typed value. Override this method to type the value if necessary """ - return value + return value or None def process_posted(self, form): for field in self.actual_fields(form): diff -r bd8480824e0b -r 91a56a30141e web/formwidgets.py --- a/web/formwidgets.py Wed Jan 27 09:57:53 2010 +0100 +++ b/web/formwidgets.py Wed Jan 27 09:59:13 2010 +0100 @@ -115,7 +115,7 @@ posted = form._cw.form val = posted.get(field.input_name(form, self.suffix)) if isinstance(val, basestring): - val = val.strip() or None + val = val.strip() return val @deprecated('[3.6] use values_and_attributes')