Any movement on this? I can't seem to get jsonrpclib to force parameterized queries. Replicating this is fairly simple:
1. Create a new app, in default.py add a function. Replace t_test with auth or whatever:
@service.jsonrpc
def list():
data = db(db.t_test.ALL).select()
return dict(data=data)
2. Drop to a python shell:
>>> import jsonrpclib
>>> j = jsonrpclib.Server(uri='
http://localhost:8000/appname/default/call/jsonrpc')
>>> j.list()
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line 276, in __call__
return self.__send(self.__name, kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line 225, in _request
check_for_errors(response)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line 529, in check_for_errors
raise ProtocolError((code, message))
ProtocolError: (100, u'TypeError: list() argument after ** must be a mapping, not str')
Same problem with simplejsonrpc in gluon/contrib...
Niphlod wrote:
> uhm. The "problem" is that even though every jsonrpc interface I
> worked with was parameter-based, for jsonrpc2 position-based and
> parameter-based are both valid.
>
> On Tuesday, December 11, 2012 10:42:06 PM UTC+1, Jonathan Lundell wrote:
>
> On 11 Dec 2012, at 1:09 PM, Niphlod <
nip...@gmail.com
> <javascript:>> wrote:
>> I took some time to watch at the jsonrpc specs. Right now I had
>> experience with jsonrpc only in the "named parameters" format. I
>> thought it was the standard, my bad.
>> However, I found out that 2.0 introduced "named parameters" that
>> were not supported - explicitely - in 1.0
>>
>> --> {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1}
>> <-- {"jsonrpc": "2.0", "result": 19, "id": 1}
>>
>> --> {"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3}
>> <-- {"jsonrpc": "2.0", "result": 19, "id": 3}
>>
>> are both valid.
>>
>> Maybe revert this and make a jsonrpc2 decorator to support named
>> parameters explicitely would be a better solution?
>
> How about both jsonrpc1 and jsonrpc2, and then jsonrpc = jsonrpc2?
> (I think it'd be better to make v2 the default.)
>
>>
>> On Tuesday, December 11, 2012 9:57:50 PM UTC+1, Kurt Grutzmacher
>> wrote:
>>
>> I don't think this is a good JSON-RPC example as the change
>> broke our app that uses simplejsonrpc or jsonrpclib to make
>> API calls.
>>
>> Based on the jsonrpclib python module
>> @
https://code.google.com/p/jsonrpclib/
>> <
https://code.google.com/p/jsonrpclib/> requests look like:
>>
>> >>> import jsonrpclib
>> >>> server = jsonrpclib.Server('
http://localhost:8080 <
http://localhost:8080/>')
>> "*message*": "variableholdingmessage", "*uid*" :
> --
>
>
>