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:
parent
586dbaa932
commit
86bffd67b3
1 changed files with 2 additions and 0 deletions
|
@ -52,6 +52,8 @@ class API(object):
|
||||||
|
|
||||||
def _add_action(self, action):
|
def _add_action(self, action):
|
||||||
def method(self, *args, **kw):
|
def method(self, *args, **kw):
|
||||||
|
if args and kw:
|
||||||
|
raise ValueError('pass either a dictionary or kwargs, not both')
|
||||||
if not kw:
|
if not kw:
|
||||||
if args:
|
if args:
|
||||||
kw = args[0]
|
kw = args[0]
|
||||||
|
|
Loading…
Reference in a new issue