From bd9c2320a0920501cde9c53b46a38651a9a84809 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 27 Jul 2015 13:52:11 +0100 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. --- 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] -- 2.4.3