Ticket #5161: patch_5161.diff

File patch_5161.diff, 1.0 KB (added by durdinator, 17 years ago)
  • django/db/backends/mysql/base.py

     
    2424import types
    2525import re
    2626
     27# Raise exceptions for database warnings if DEBUG is on
     28if settings.DEBUG:
     29    from warnings import filterwarnings
     30    filterwarnings("error", category=Database.Warning)
     31
    2732DatabaseError = Database.DatabaseError
    2833IntegrityError = Database.IntegrityError
    2934
     
    153158        return False
    154159
    155160    def _cursor(self, settings):
    156         from warnings import filterwarnings
    157161        if not self._valid_connection():
    158162            kwargs = {
    159163                'conv': django_conversions,
     
    175179            kwargs.update(self.options)
    176180            self.connection = Database.connect(**kwargs)
    177181        cursor = self.connection.cursor()
    178         if settings.DEBUG:
    179             filterwarnings("error", category=Database.Warning)
    180182        return cursor
    181183
    182184    def _rollback(self):
Back to Top