--- a/web/formfields.py Fri Feb 05 17:13:53 2010 +0100
+++ b/web/formfields.py Tue Feb 09 19:50:31 2010 +0100
@@ -624,6 +624,9 @@
def _ensure_correctly_typed(self, form, value):
if isinstance(value, basestring):
+ value = value.strip()
+ if not value:
+ return None
try:
return int(value)
except ValueError:
@@ -655,6 +658,9 @@
def _ensure_correctly_typed(self, form, value):
if isinstance(value, basestring):
+ value = value.strip()
+ if not value:
+ return None
try:
return float(value)
except ValueError:
@@ -669,7 +675,7 @@
def format_single_value(self, req, value):
if value:
- return ustrftime(value, req.property_value(self.format_prop))
+ return ustrftime(value.strip(), req.property_value(self.format_prop))
return u''
def render_example(self, req):
@@ -677,6 +683,9 @@
def _ensure_correctly_typed(self, form, value):
if isinstance(value, basestring):
+ value = value.strip()
+ if not value:
+ return None
try:
value = form._cw.parse_datetime(value, self.etype)
except ValueError, ex: