[web] Handle unspecified 'date' or 'time' in JQueryDateTimePicker.process_field_data()
dict.get() may return None, which has no attribute strip.
--- a/cubicweb/web/formwidgets.py Fri Jan 20 15:16:18 2017 +0100
+++ b/cubicweb/web/formwidgets.py Thu Jan 26 16:33:15 2017 +0100
@@ -801,8 +801,12 @@
def process_field_data(self, form, field):
req = form._cw
- datestr = req.form.get(field.input_name(form, 'date')).strip() or None
- timestr = req.form.get(field.input_name(form, 'time')).strip() or None
+ datestr = req.form.get(field.input_name(form, 'date'))
+ if datestr:
+ datestr = datestr.strip() or None
+ timestr = req.form.get(field.input_name(form, 'time'))
+ if timestr:
+ timestr = timestr.strip() or None
if datestr is None:
return None
try: