From 86bffd67b33d41d668a0b3f415109e3a676ca70b Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Sun, 2 Aug 2015 15:57:48 +0200 Subject: [PATCH] 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 --- ox/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ox/api.py b/ox/api.py index 3b57ae2..9717ff2 100644 --- a/ox/api.py +++ b/ox/api.py @@ -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]