Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored September 25, 2006
2  django/core/management.py
@@ -347,7 +347,7 @@ def get_sql_initial_data_for_model(model):
347 347
                  os.path.join(app_dir, "%s.sql" % opts.object_name.lower())]
348 348
     for sql_file in sql_files:
349 349
         if os.path.exists(sql_file):
350  
-            fp = open(sql_file)
  350
+            fp = open(sql_file, 'U')
351 351
             for statement in statements.split(fp.read()):
352 352
                 if statement.strip():
353 353
                     output.append(statement + ";")
1  tests/regressiontests/initial_sql_regress/sql/simple.sql
@@ -4,4 +4,5 @@ INSERT INTO initial_sql_regress_simple (name) VALUES ('Ringo');
4 4
 INSERT INTO initial_sql_regress_simple (name) VALUES ('George');
5 5
 INSERT INTO initial_sql_regress_simple (name) VALUES ('Miles O''Brien');
6 6
 INSERT INTO initial_sql_regress_simple (name) VALUES ('Semicolon;Man');
  7
+INSERT INTO initial_sql_regress_simple (name) VALUES ('This line has a Windows line ending');
7 8
 

0 notes on commit 6dacb3d

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