Closed koelie closed 10 years ago
Hey koelle -- thanks for this! Do you think you could provide a test for this behavior as well, so we make sure we don't squash it later?
test added
Hi Josh, can you add this fix to your tornadorpc? The version I'm getting still have the issue. Meanwhile I can use koelie's fork.
following up on my msg on the google groups, this is a fix for the order default arguments are set in. Currently they are set in reverse order as the following example shows:
server code:
from tornadorpc.json import JSONRPCHandler from tornadorpc import start_server class Handler(JSONRPCHandler): def test(self, a=1, b=2, c=3, d=4): return {'a': a, 'b': b, 'c': c, 'd': d} start_server(Handler, port=8888)
client code:
import jsonrpclib server = jsonrpclib.Server('http://localhost:8888') print server.test() print server.test(a='one') print server.test(d='four') print server.test(a='one',b='two',c='three',d='four')
This prints (unicode markers removed for readability): {'a': 4, 'c': 2, 'b': 3, 'd': 1} {'a': 'one', 'c': 2, 'b': 3, 'd': 1} {'a': 4, 'c': 2, 'b': 3, 'd': 'four'} {'a': 'one', 'c': 'three', 'b': 'two', 'd': 'four'}
note that the defaults are set in reverse order. My patch fixes this.