﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1336	[patch] USStateField do_html2python(data) throws exception when data is None	chrisb@…	Adrian Holovaty	"The USStateField do_html2python method calls ""upper()"" on the data passed to it. If the ""data"" is None, as it is in the case where you allow users to not select a state (i.e. state is not required), then it calls upper() on ""None"" which fails.

Patch is simple - test data before returning data.upper(), otherwise just return the data.

{{{
Index: formfields.py
===================================================================
--- formfields.py	(revision 2292)
+++ formfields.py	(working copy)
@@ -875,7 +875,10 @@
             raise validators.CriticalValidationError, e.messages
 
     def html2python(data):
-        return data.upper() # Should always be stored in upper case
+        if data:
+            return data.upper() # Should always be stored in upper case
+        else:
+            return data
     html2python = staticmethod(html2python)
 
 class CommaSeparatedIntegerField(TextField):
}}}
"	defect	closed	Core (Other)	dev	normal	fixed			Ready for checkin	1	0	0	0	0	0
