diff roundup/rest.py @ 5823:edd9e2c67785

Make REST-API updates work with WSGI Now the Content-Type header is handled specially, it doesn't have a HTTP_ prefix in WSGI. Also make some form lookups more robust in rest.
author Ralf Schlatterbeck <rsc@runtux.com>
date Sun, 23 Jun 2019 14:46:05 +0200
parents bab86c874efb
children 352e78c3b4ab
line wrap: on
line diff
--- a/roundup/rest.py	Fri Jun 21 18:20:06 2019 +0200
+++ b/roundup/rest.py	Sun Jun 23 14:46:05 2019 +0200
@@ -1828,7 +1828,9 @@
         # check for pretty print
         try:
             pretty_output = not input['@pretty'].value.lower() == "false"
-        except KeyError:
+        # Can also return a TypeError ("not indexable")
+        # In case the FieldStorage could not parse the result
+        except (KeyError, TypeError):
             pretty_output = True
 
         # check for @apiver in query string
@@ -1838,7 +1840,9 @@
         try:
             if not self.api_version:
                 self.api_version = int(input['@apiver'].value)
-        except KeyError:
+        # Can also return a TypeError ("not indexable")
+        # In case the FieldStorage could not parse the result
+        except (KeyError, TypeError):
             self.api_version = None
         except ValueError:
             output = self.error_obj(400, msg%input['@apiver'].value)

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