Kaydet (Commit) dfdbf9ec authored tarafından Adrian Holovaty's avatar Adrian Holovaty

Fixed #5161 -- Changed MySQL backend only to report warning once. Thanks, durdinator

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst 59964c2c
......@@ -24,6 +24,11 @@ from MySQLdb.constants import FIELD_TYPE
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 @@ class DatabaseWrapper(BaseDatabaseWrapper):
return False
def _cursor(self, settings):
from warnings import filterwarnings
if not self._valid_connection():
kwargs = {
'conv': django_conversions,
......@@ -175,8 +179,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment