summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-12-03 20:03:05 +0100
committerClaude Paroz <claude@2xlibre.net>2012-12-03 20:47:08 +0100
commit5fa5621f574f9ae211ed756c3e2ad453470dae8a (patch)
treedd0cfc224b9172ecfb82317122512c02838422aa /django
parent6d27547d202586c5f85909de84a012bc177f7a30 (diff)
Fixed #19416 -- Fixed multi-line commands in initial SQL files
Thanks Aymeric Augustin for detecting this regression.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/sql.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/django/core/management/sql.py b/django/core/management/sql.py
index 78cd17a23a..ea03e9088c 100644
--- a/django/core/management/sql.py
+++ b/django/core/management/sql.py
@@ -145,15 +145,15 @@ def sql_all(app, style, connection):
def _split_statements(content):
comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$")
statements = []
- statement = ""
+ statement = []
for line in content.split("\n"):
cleaned_line = comment_re.sub(r"\1", line).strip()
if not cleaned_line:
continue
- statement += cleaned_line
- if statement.endswith(";"):
- statements.append(statement)
- statement = ""
+ statement.append(cleaned_line)
+ if cleaned_line.endswith(";"):
+ statements.append(" ".join(statement))
+ statement = []
return statements