Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 6dacb3d10b4a29cca54e2f0196b24f471a10ceb9 1 parent f1c6399
@malcolmt malcolmt authored
View
2  django/core/management.py
@@ -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 + ";")
View
1  tests/regressiontests/initial_sql_regress/sql/simple.sql
@@ -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');

0 comments on commit 6dacb3d

Please sign in to comment.
Something went wrong with that request. Please try again.