Fixed #2729 -- Handle initial SQL with different line-ending styles (Windows
vs. Unix vs. Mac). Thanks, Simon Greenhill. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f1c63992f7
commit
6dacb3d10b
|
@ -347,7 +347,7 @@ def get_sql_initial_data_for_model(model):
|
|||
os.path.join(app_dir, "%s.sql" % opts.object_name.lower())]
|
||||
for sql_file in sql_files:
|
||||
if os.path.exists(sql_file):
|
||||
fp = open(sql_file)
|
||||
fp = open(sql_file, 'U')
|
||||
for statement in statements.split(fp.read()):
|
||||
if statement.strip():
|
||||
output.append(statement + ";")
|
||||
|
|
|
@ -4,4 +4,5 @@ INSERT INTO initial_sql_regress_simple (name) VALUES ('Ringo');
|
|||
INSERT INTO initial_sql_regress_simple (name) VALUES ('George');
|
||||
INSERT INTO initial_sql_regress_simple (name) VALUES ('Miles O''Brien');
|
||||
INSERT INTO initial_sql_regress_simple (name) VALUES ('Semicolon;Man');
|
||||
INSERT INTO initial_sql_regress_simple (name) VALUES ('This line has a Windows line ending');
|
||||
|
||||
|
|
Loading…
Reference in New Issue