From 2e1beac9da9540c9498e7efcafee41dbe602ed4b Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 8 Jan 2009 19:59:11 +0000 Subject: [PATCH] skytools.quote_statement: accept arg list (from 2.2) --- python/skytools/quoting.py | 16 ++++++---------- 1 file 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 = { -- 2.39.5