diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-12-03 20:03:05 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-12-03 20:49:28 +0100 |
| commit | 3d62eaea692b230ddc45faa48286b356ca561218 (patch) | |
| tree | 393e83c95dd6b5bcb39a623cb9b8a514d3bf6620 /django/core/management/sql.py | |
| parent | c9a47fb379cab4c0fe9be27c9924236e75327bd0 (diff) | |
[1.5.x] Fixed #19416 -- Fixed multi-line commands in initial SQL files
Thanks Aymeric Augustin for detecting this regression.
Backport of 5fa5621f5 from master.
Diffstat (limited to 'django/core/management/sql.py')
| -rw-r--r-- | django/core/management/sql.py | 10 |
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 |
