diff roundup/cgi/client.py @ 4799:b474adb17fda

Fix case where querying form returns a TypeError
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 08 Jul 2013 09:57:39 +0200
parents 6e9b9743de89
children 3961b2b91568
line wrap: on
line diff
--- a/roundup/cgi/client.py	Sat Jul 06 13:01:59 2013 +0200
+++ b/roundup/cgi/client.py	Mon Jul 08 09:57:39 2013 +0200
@@ -601,15 +601,17 @@
         """
         # look for client charset
         charset_parameter = 0
-        if '@charset' in self.form:
+        # Python 2.6 form may raise a TypeError if list in form is None
+        charset = None
+        try :
             charset = self.form['@charset'].value
             if charset.lower() == "none":
                 charset = ""
             charset_parameter = 1
-        elif 'roundup_charset' in self.cookie:
+        except (KeyError, TypeError):
+            pass
+        if charset is None and 'roundup_charset' in self.cookie:
             charset = self.cookie['roundup_charset'].value
-        else:
-            charset = None
         if charset:
             # make sure the charset is recognized
             try:

Roundup Issue Tracker: http://roundup-tracker.org/