/usr/share/pyshared/django_evolution/utils.py is in python-django-evolution 0.6.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from django_evolution.db import EvolutionOperationsMulti
def write_sql(sql, database):
"Output a list of SQL statements, unrolling parameters as required"
qp = EvolutionOperationsMulti(database).get_evolver().quote_sql_param
for statement in sql:
if isinstance(statement, tuple):
print unicode(statement[0] % tuple(qp(s) for s in statement[1]))
else:
print unicode(statement)
def execute_sql(cursor, sql):
"""
Execute a list of SQL statements on the provided cursor, unrolling
parameters as required
"""
for statement in sql:
if isinstance(statement, tuple):
if not statement[0].startswith('--'):
cursor.execute(*statement)
else:
if not statement.startswith('--'):
cursor.execute(statement)
|