Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #5161 -- Changed MySQL backend only to report warning once. Tha…

…nks, durdinator

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit dfdbf9ec1e50ac0416297503b05322cdd2f5234a 1 parent 59964c2
@adrianholovaty adrianholovaty authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 django/db/backends/mysql/base.py
View
8 django/db/backends/mysql/base.py
@@ -24,6 +24,11 @@
import types
import re
+# Raise exceptions for database warnings if DEBUG is on
+if settings.DEBUG:
+ from warnings import filterwarnings
+ filterwarnings("error", category=Database.Warning)
+
DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError
@@ -153,7 +158,6 @@ def _valid_connection(self):
return False
def _cursor(self, settings):
- from warnings import filterwarnings
if not self._valid_connection():
kwargs = {
'conv': django_conversions,
@@ -175,8 +179,6 @@ def _cursor(self, settings):
kwargs.update(self.options)
self.connection = Database.connect(**kwargs)
cursor = self.connection.cursor()
- if settings.DEBUG:
- filterwarnings("error", category=Database.Warning)
return cursor
def _rollback(self):
Please sign in to comment.
Something went wrong with that request. Please try again.