Skip to content

Commit

Permalink
[#1374] datastore:use bind params instead of string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
joetsoi authored and amercader committed Feb 10, 2015
1 parent 6935648 commit 0cf8a2c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ckanext/datastore/plugin.py
Expand Up @@ -180,10 +180,9 @@ def _read_connection_has_correct_privileges(self):
try:
write_connection.execute(u'CREATE TEMP TABLE _foo ()')
for privilege in ['INSERT', 'UPDATE', 'DELETE']:
test_privilege_sql = u"SELECT has_table_privilege('{user}', '_foo', '{privilege}')"
sql = test_privilege_sql.format(user=read_connection_user,
privilege=privilege)
have_privilege = write_connection.execute(sql).first()[0]
test_privilege_sql = u"SELECT has_table_privilege(%s, '_foo', %s)"
have_privilege = write_connection.execute(
test_privilege_sql, (read_connection_user, privilege)).first()[0]
if have_privilege:
return False
finally:
Expand Down

0 comments on commit 0cf8a2c

Please sign in to comment.