Ticket #16250: 16250-2.diff

File 16250-2.diff, 2.5 KB (added by Ramiro Morales, 13 years ago)

More invasive fix

  • django/db/backends/creation.py

    diff -r 7d5687126d6d django/db/backends/creation.py
    a b  
    247247            verbosity=max(verbosity - 1, 0),
    248248            interactive=False,
    249249            database=self.connection.alias)
    250        
     250
    251251        # One effect of calling syncdb followed by flush is that the id of the
    252252        # default site may or may not be 1, depending on how the sequence was
    253253        # reset.  If the sites app is loaded, then we coerce it.
     
    346346
    347347    def set_autocommit(self):
    348348        "Make sure a connection is in autocommit mode."
    349         if hasattr(self.connection.connection, "autocommit"):
    350             if callable(self.connection.connection.autocommit):
    351                 self.connection.connection.autocommit(True)
    352             else:
    353                 self.connection.connection.autocommit = True
    354         elif hasattr(self.connection.connection, "set_isolation_level"):
    355             self.connection.connection.set_isolation_level(0)
     349        pass
    356350
    357351    def sql_table_creation_suffix(self):
    358352        "SQL to append to the end of the test table creation statements"
  • django/db/backends/oracle/creation.py

    diff -r 7d5687126d6d django/db/backends/oracle/creation.py
    a b  
    270270            settings_dict['NAME'],
    271271            self._test_database_user(),
    272272        )
     273
     274    def set_autocommit(self):
     275        self.connection.connection.autocommit = True
  • django/db/backends/postgresql_psycopg2/creation.py

    diff -r 7d5687126d6d django/db/backends/postgresql_psycopg2/creation.py
    a b  
    7676        else:
    7777            output = []
    7878        return output
     79
     80    def set_autocommit(self):
     81        self.connection.connection.set_isolation_level(0)
  • django/db/backends/sqlite3/creation.py

    diff -r 7d5687126d6d django/db/backends/sqlite3/creation.py
    a b  
    6969        if test_database_name and test_database_name != ":memory:":
    7070            # Remove the SQLite database file
    7171            os.remove(test_database_name)
     72
     73    def set_autocommit(self):
     74        self.connection.connection.isolation_level = None
Back to Top