Ticket #4680: initial_sql.diff
File initial_sql.diff, 946 bytes (added by , 17 years ago) |
---|
-
core/management.py
424 424 # Find custom SQL, if it's available. 425 425 sql_files = [os.path.join(app_dir, "%s.%s.sql" % (opts.object_name.lower(), settings.DATABASE_ENGINE)), 426 426 os.path.join(app_dir, "%s.sql" % opts.object_name.lower())] 427 comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$") 427 428 for sql_file in sql_files: 428 429 if os.path.exists(sql_file): 429 430 fp = open(sql_file, 'U') 430 431 for statement in statements.split(fp.read()): 431 432 # Remove any comments from the file 432 statement = re.sub(r"--.*[\n\Z]", "", statement)433 statement = comment_re.sub(r"\1", statement) 433 434 if statement.strip(): 434 435 output.append(statement + ";") 435 436 fp.close()