Kaydet (Commit) 6dacb3d1 authored tarafından Malcolm Tredinnick's avatar Malcolm Tredinnick

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
üst f1c63992
......@@ -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');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment