From a84bb7c72f239ad280256d70eaaec5c862dfef85 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 05 2016 09:00:30 +0000 Subject: Allow all the forms containing an optional SelectField to return None Otherwise, when the field was containing None it would be converted to 'None' this is due to the default coerce being `unicode` in wtforms cf: http://wtforms.simplecodes.com/docs/0.6/fields.html#wtforms.fields.SelectField --- diff --git a/pagure/forms.py b/pagure/forms.py index 682beb2..0698df2 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -295,7 +295,8 @@ class UpdateIssueForm(FlaskForm): milestone = wtforms.SelectField( 'Milestone', [wtforms.validators.Optional()], - choices=[] + choices=[], + coerce=lambda val: unicode(val) if val else None ) private = wtforms.BooleanField( 'Private',