diff options
author | Marko Kreen | 2009-01-08 19:59:11 +0000 |
---|---|---|
committer | Marko Kreen | 2009-01-08 19:59:11 +0000 |
commit | 2e1beac9da9540c9498e7efcafee41dbe602ed4b (patch) | |
tree | eeb254bc064c73be834f108ce4c0a229fec2b473 /python/skytools/quoting.py | |
parent | fd55d00a1c0a1be41c86070f9909b8a3f1d33ebd (diff) |
skytools.quote_statement: accept arg list (from 2.2)
Diffstat (limited to 'python/skytools/quoting.py')
-rw-r--r-- | python/skytools/quoting.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/python/skytools/quoting.py b/python/skytools/quoting.py index a0c2c0d8..8225c7b0 100644 --- a/python/skytools/quoting.py +++ b/python/skytools/quoting.py @@ -34,19 +34,15 @@ def quote_bytea_copy(s): return quote_copy(quote_bytea_raw(s)) -def quote_statement(sql, dict_or_list): +def quote_statement(sql, dict): """Quote whole statement. - Data values are taken from dict or list or tuple. + Data values are taken from dict. """ - if hasattr(dict_or_list, 'items'): - qvals = {} - for k, v in dict_or_list.items(): - qvals[k] = quote_literal(v) - else: - qvals = [quote_literal(v) for v in dict_or_list] - qvals = tuple(qvals) - return sql % qvals + xdict = {} + for k, v in dict.items(): + xdict[k] = quote_literal(v) + return sql % xdict # reserved keywords _ident_kwmap = { |