Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04104ec

Browse files
authored
Merge pull request lionheart#141 from rogeremasse/python3
Two line change to convert bytes type to str if needed in Python 3.
2 parents d829d87 + f0188de commit 04104ec

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

django_pyodbc/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ def format_sql(self, sql, n_params=None):
454454
else:
455455
if '%s' in sql:
456456
sql = sql.replace('%s', '?')
457+
if sys.version.startswith('3') and type(sql) is not str:
458+
sql = sql.decode(self.encoding or sys.stdout.encoding)
457459
return sql
458460

459461
def format_params(self, params):

0 commit comments

Comments
 (0)