Fixed #17923 -- Added missing import in the MySQL and Oracle backends. Thanks aldaran for the report. Also removed two duplicate imports.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17758 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Aymeric Augustin 2012-03-17 09:11:24 +00:00
parent e57bedee78
commit 8d71734f15
3 changed files with 3 additions and 3 deletions

View File

@ -7,6 +7,7 @@ Requires MySQLdb: http://sourceforge.net/projects/mysql-python
import datetime import datetime
import re import re
import sys import sys
import warnings
try: try:
import MySQLdb as Database import MySQLdb as Database
@ -39,8 +40,7 @@ from django.utils import timezone
# Raise exceptions for database warnings if DEBUG is on # Raise exceptions for database warnings if DEBUG is on
from django.conf import settings from django.conf import settings
if settings.DEBUG: if settings.DEBUG:
from warnings import filterwarnings warnings.filterwarnings("error", category=Database.Warning)
filterwarnings("error", category=Database.Warning)
DatabaseError = Database.DatabaseError DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError IntegrityError = Database.IntegrityError

View File

@ -8,6 +8,7 @@ Requires cx_Oracle: http://cx-oracle.sourceforge.net/
import datetime import datetime
import decimal import decimal
import sys import sys
import warnings
def _setup_environment(environ): def _setup_environment(environ):

View File

@ -110,7 +110,6 @@ else:
class CompatCookie(SimpleCookie): class CompatCookie(SimpleCookie):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(CompatCookie, self).__init__(*args, **kwargs) super(CompatCookie, self).__init__(*args, **kwargs)
import warnings
warnings.warn("CompatCookie is deprecated. Use django.http.SimpleCookie instead.", DeprecationWarning) warnings.warn("CompatCookie is deprecated. Use django.http.SimpleCookie instead.", DeprecationWarning)
from django.conf import settings from django.conf import settings