API: raise if caller supplies both dict and kwargs

I (incorrectly) wrote something like the following:

    api.find({'query': {...}}, keys=['id'], range=[0, n])

and the query was silently ignored, giving totally different
results to what I wanted. fixes #2822
This commit is contained in:
Will Thompson 2015-08-02 15:57:48 +02:00 committed by j
parent 586dbaa932
commit 86bffd67b3

View file

@ -52,6 +52,8 @@ class API(object):
def _add_action(self, action):
def method(self, *args, **kw):
if args and kw:
raise ValueError('pass either a dictionary or kwargs, not both')
if not kw:
if args:
kw = args[0]