Ticket #4680: initial_sql.diff

File initial_sql.diff, 946 bytes (added by Tim Chase, 17 years ago)

"svn diff" against trunk

  • core/management.py

     
    424424    # Find custom SQL, if it's available.
    425425    sql_files = [os.path.join(app_dir, "%s.%s.sql" % (opts.object_name.lower(), settings.DATABASE_ENGINE)),
    426426                 os.path.join(app_dir, "%s.sql" % opts.object_name.lower())]
     427    comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$")
    427428    for sql_file in sql_files:
    428429        if os.path.exists(sql_file):
    429430            fp = open(sql_file, 'U')
    430431            for statement in statements.split(fp.read()):
    431432                # Remove any comments from the file
    432                 statement = re.sub(r"--.*[\n\Z]", "", statement)
     433                statement = comment_re.sub(r"\1", statement)
    433434                if statement.strip():
    434435                    output.append(statement + ";")
    435436            fp.close()
Back to Top