Ticket #3024: check_connection_for_none.diff

File check_connection_for_none.diff, 3.5 KB (added by Bastian Kleineidam <calvin@…>, 8 years ago)
  • django/db/backends/ado_mssql/base.py

     
    7676        return cursor
    7777
    7878    def _commit(self):
    79         return self.connection.commit()
     79        if self.connection is not None:
     80            return self.connection.commit()
    8081
    8182    def _rollback(self):
    82         if self.connection:
     83        if self.connection is not None:
    8384            return self.connection.rollback()
    8485
    8586    def close(self):
  • django/db/backends/postgresql/base.py

     
    5050        return cursor
    5151
    5252    def _commit(self):
    53         return self.connection.commit()
     53        if self.connection is not None:
     54            return self.connection.commit()
    5455
    5556    def _rollback(self):
    56         if self.connection:
     57        if self.connection is not None:
    5758            return self.connection.rollback()
    5859
    5960    def close(self):
  • django/db/backends/sqlite3/base.py

     
    6767            return cursor
    6868
    6969    def _commit(self):
    70         self.connection.commit()
     70        if self.connection is not None:
     71            self.connection.commit()
    7172
    7273    def _rollback(self):
    73         if self.connection:
     74        if self.connection is not None:
    7475            self.connection.rollback()
    7576
    7677    def close(self):
  • django/db/backends/mysql/base.py

     
    106106        return cursor
    107107
    108108    def _commit(self):
    109         self.connection.commit()
     109        if self.connection is not None:
     110            self.connection.commit()
    110111
    111112    def _rollback(self):
    112         if self.connection:
     113        if self.connection is not None:
    113114            try:
    114115                self.connection.rollback()
    115116            except Database.NotSupportedError:
  • django/db/backends/oracle/base.py

     
    4343        return FormatStylePlaceholderCursor(self.connection)
    4444
    4545    def _commit(self):
    46         self.connection.commit()
     46        if self.connection is not None:
     47            self.connection.commit()
    4748
    4849    def _rollback(self):
    49         if self.connection:
     50        if self.connection is not None:
    5051            try:
    5152                self.connection.rollback()
    5253            except Database.NotSupportedError:
  • django/db/backends/postgresql_psycopg2/base.py

     
    5151        return cursor
    5252
    5353    def _commit(self):
    54         return self.connection.commit()
     54        if self.connection is not None:
     55            return self.connection.commit()
    5556
    5657    def _rollback(self):
    57         if self.connection:
     58        if self.connection is not None:
    5859            return self.connection.rollback()
    5960
    6061    def close(self):
Back to Top