diff roundup/rest.py @ 5690:4aae822e2cb4

Added a few comments and a test that fails with the pre-patched code and uses POST.
author John Rouillard <rouilj@ieee.org>
date Wed, 03 Apr 2019 07:04:29 -0400
parents 2c516d113620
children dbf422a8cff7
line wrap: on
line diff
--- a/roundup/rest.py	Wed Apr 03 12:08:18 2019 +0200
+++ b/roundup/rest.py	Wed Apr 03 07:04:29 2019 -0400
@@ -1609,7 +1609,9 @@
 
     references used when accessing a FieldStorage structure.
 
-    That's what this class does.
+    That's what this class does with all names and values as native
+    strings. Note that json is UTF-8, so we convert any unicode to
+    string.
 
     '''
     def __init__(self, json_string):
@@ -1625,10 +1627,13 @@
         def __init__(self, name, val):
             self.name=u2s(name)
             if is_us(val):
+                # handle most common type first
                 self.value=u2s(val)
             elif type(val) == type([]):
+                # then lists of strings    
                 self.value = [ u2s(v) for v in val ]
             else:
+                # then stringify anything else (int, float)
                 self.value = str(val)
 
     def __getitem__(self, index):

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