1 | Index: management.py
|
---|
2 | ===================================================================
|
---|
3 | --- management.py (revision 3110)
|
---|
4 | +++ management.py (working copy)
|
---|
5 | @@ -341,10 +341,14 @@
|
---|
6 | # Find custom SQL, if it's available.
|
---|
7 | sql_files = [os.path.join(app_dir, "%s.%s.sql" % (opts.object_name.lower(), settings.DATABASE_ENGINE)),
|
---|
8 | os.path.join(app_dir, "%s.sql" % opts.object_name.lower())]
|
---|
9 | +
|
---|
10 | + statements = re.compile(";[ \t]*$", re.M)
|
---|
11 | for sql_file in sql_files:
|
---|
12 | if os.path.exists(sql_file):
|
---|
13 | fp = open(sql_file)
|
---|
14 | - output.extend(sql_expr.findall(fp.read()))
|
---|
15 | + for statement in statements.split(fp.read()):
|
---|
16 | + if statement.strip():
|
---|
17 | + output.append(statement+";")
|
---|
18 | fp.close()
|
---|
19 |
|
---|
20 | return output
|
---|