[Checkins] SVN: z3c.json/trunk/ raise ValueError for mixed parameters on any JSON-RPC version

Roger Ineichen roger at projekt01.ch
Mon Feb 23 22:10:22 EST 2009


Log message for revision 97186:
  raise ValueError for mixed parameters on any JSON-RPC version

Changed:
  U   z3c.json/trunk/CHANGES.txt
  U   z3c.json/trunk/src/z3c/json/proxy.py

-=-
Modified: z3c.json/trunk/CHANGES.txt
===================================================================
--- z3c.json/trunk/CHANGES.txt	2009-02-24 03:01:37 UTC (rev 97185)
+++ z3c.json/trunk/CHANGES.txt	2009-02-24 03:10:20 UTC (rev 97186)
@@ -2,12 +2,17 @@
 CHANGES
 =======
 
-Version 0.5.3dev (unreleased)
------------------------------
+0.5.3dev (unreleased)
+---------------------
 
+- raise ValueError for mixed parameters on any JSON-RPC version
+
 - do not test for response len if response is an int
+
 - fixed possible unicode error in case of response error
+
 - made all tests pass (JSONWriter inserts no whitespace)
+
 - added parse_response_headers to allow subclasses to handle header values if
   needed.
 
@@ -16,13 +21,13 @@
   for more information.
 
 
-Version 0.5.1 (2008-01-24)
---------------------------
+0.5.1 (2008-01-24)
+------------------
 
 - Improved meta-data.
 
 
-Version 0.5.0 (2008-01-21)
---------------------------
+0.5.0 (2008-01-21)
+------------------
 
 - Initial Release

Modified: z3c.json/trunk/src/z3c/json/proxy.py
===================================================================
--- z3c.json/trunk/src/z3c/json/proxy.py	2009-02-24 03:01:37 UTC (rev 97185)
+++ z3c.json/trunk/src/z3c/json/proxy.py	2009-02-24 03:10:20 UTC (rev 97186)
@@ -56,24 +56,26 @@
             request['jsonrpc'] = self.jsonVersion
         request['method'] = self.name
 
+        # There is not support for postional and named parameters in one 
+        # call. We propably will add support for this within a extension
+        # in a later version. Till then, we will raise an exception if
+        # we will get both paramters.
+        if len(args) > 0 and len(kwargs) > 0:
+            raise ValueError(
+                'Mixing positional and named parameters in one call is not possible')
+
         if self.jsonVersion in ['1.0', '1.1']:
-            if len(kwargs) > 0:
+            if len(args) > 0:
+                params = args
+            elif len(kwargs) > 0:
                 params = copy.copy(kwargs)
                 index = 0
                 for arg in args:
                     params[str(index)] = arg
                     index += 1
-            elif len(args) > 0:
-                params = args
             else:
                 params = []
         else:
-            # There is not support for postional and named parameters in one 
-            # call. We propably will add support for this within a extension
-            # in a later version. Till then, we will raise an exception if
-            # we will get both paramters.
-            if len(args) > 0 and len(kwargs) > 0:
-                raise ValueError('Mixing positional and named parameters in one call is not possible')
             if len(args) > 0:
                 params = args
             elif len(kwargs) > 0:



More information about the Checkins mailing list