[Checkins] SVN: z3c.jsonrpc/branches/lovely/ - support non positional arguments for all jsonrpc versions
Juergen Kartnaller
juergen at kartnaller.at
Mon Feb 23 07:21:50 EST 2009
Log message for revision 97153:
- support non positional arguments for all jsonrpc versions
Changed:
U z3c.jsonrpc/branches/lovely/CHANGES.txt
U z3c.jsonrpc/branches/lovely/setup.py
U z3c.jsonrpc/branches/lovely/src/z3c/jsonrpc/publisher.py
-=-
Modified: z3c.jsonrpc/branches/lovely/CHANGES.txt
===================================================================
--- z3c.jsonrpc/branches/lovely/CHANGES.txt 2009-02-23 12:19:59 UTC (rev 97152)
+++ z3c.jsonrpc/branches/lovely/CHANGES.txt 2009-02-23 12:21:50 UTC (rev 97153)
@@ -2,6 +2,11 @@
CHANGES
=======
+Branches/lovely
+---------------
+
+ - support non positional arguments for all jsonrpc versions
+
Version 0.5.2dev (unreleased)
-----------------------------
Modified: z3c.jsonrpc/branches/lovely/setup.py
===================================================================
--- z3c.jsonrpc/branches/lovely/setup.py 2009-02-23 12:19:59 UTC (rev 97152)
+++ z3c.jsonrpc/branches/lovely/setup.py 2009-02-23 12:21:50 UTC (rev 97153)
@@ -25,7 +25,7 @@
setup (
name='z3c.jsonrpc',
- version='0.5.2dev',
+ version='0.5.2b3',
author = "Roger Ineichen and the Zope Community",
author_email = "zope-dev at zope.org",
description = "JSON RPC server and client implementation for Zope3",
Modified: z3c.jsonrpc/branches/lovely/src/z3c/jsonrpc/publisher.py
===================================================================
--- z3c.jsonrpc/branches/lovely/src/z3c/jsonrpc/publisher.py 2009-02-23 12:19:59 UTC (rev 97152)
+++ z3c.jsonrpc/branches/lovely/src/z3c/jsonrpc/publisher.py 2009-02-23 12:21:50 UTC (rev 97153)
@@ -164,35 +164,11 @@
# version for our request.
self.jsonVersion = data.get('version', self.jsonVersion)
self.jsonVersion = data.get('jsonrpc', self.jsonVersion)
- if self.jsonVersion in ['1.0', '1.1']:
+ if self.jsonVersion in ['1.0', '1.1', '2.0']:
# json-rpc 1.0 and 1.1
- args = params
- # version 1.0 and 1.1 uses a list of arguments
- for arg in args:
- if isinstance(arg, dict):
- # set every dict key value as form items and support at
- # least ``:list`` and ``:tuple`` input field name postifx
- # conversion.
- for key, d in arg.items():
- key = str(key)
- pos = key.rfind(":")
- if pos > 0:
- match = self._typeFormat.match(key, pos + 1)
- if match is not None:
- key, type_name = key[:pos], key[pos + 1:]
- if type_name == 'list' and not isinstance(d, list):
- d = [d]
- if type_name == 'tuple' and not isinstance(d, tuple):
- d = tuple(d)
- self.form[key] = d
-
- elif self.jsonVersion == '2.0':
- # version 2.0 uses a list or a dict as params. Process the list
- # params here. This params get used as positional arguments in the
- # method call.
if isinstance(params, list):
args = params
- # now, look for keyword parameters, the old way
+ # version 1.0 and 1.1 uses a list of arguments
for arg in args:
if isinstance(arg, dict):
# set every dict key value as form items and support at
@@ -210,7 +186,6 @@
if type_name == 'tuple' and not isinstance(d, tuple):
d = tuple(d)
self.form[key] = d
-
elif isinstance(params, dict):
# process the key/value pair params. This arguments get stored
# in the request.form argument and we skip it from method calls.
More information about the Checkins
mailing list