Created
September 9, 2009 06:17
-
-
Save hdknr/183514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _execSQL(self, sql_name, *args): | |
sql = self._getSQL(sql_name) | |
# Kludge because we have reports of postgresql not quoting | |
# arguments if they are passed in as unicode instead of str. | |
# Currently the strings in our tables just have ascii in them, | |
# so this ought to be safe. | |
def unicode_to_str(arg): | |
if isinstance(arg, unicode): | |
return str(arg) | |
else: | |
return arg | |
str_args = map(unicode_to_str, args) | |
self.cur.execute(sql, str_args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment