diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py index 41c627cc4d..4bf1250ac6 100644 --- a/django/contrib/admindocs/utils.py +++ b/django/contrib/admindocs/utils.py @@ -1,8 +1,9 @@ "Misc. utility functions/classes for admin documentation generator." import re -from email.Parser import HeaderParser -from email.Errors import HeaderParseError +from email.parser import HeaderParser +from email.errors import HeaderParseError + from django.utils.safestring import mark_safe from django.core.urlresolvers import reverse from django.utils.encoding import smart_str diff --git a/django/contrib/comments/forms.py b/django/contrib/comments/forms.py index bdeac99315..1c612362cc 100644 --- a/django/contrib/comments/forms.py +++ b/django/contrib/comments/forms.py @@ -4,7 +4,7 @@ from django import forms from django.forms.util import ErrorDict from django.conf import settings from django.contrib.contenttypes.models import ContentType -from models import Comment +from django.contrib.comments.models import Comment from django.utils.crypto import salted_hmac, constant_time_compare from django.utils.encoding import force_unicode from django.utils.text import get_text_list diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py index af343ffc5d..88d7ae2973 100644 --- a/django/core/cache/backends/db.py +++ b/django/core/cache/backends/db.py @@ -139,7 +139,7 @@ class DatabaseCache(BaseDatabaseCache): if connections[db].vendor == 'oracle': # Special case for Oracle because it doesn't support LIMIT + OFFSET cursor.execute("SELECT cache_key FROM (SELECT ROW_NUMBER() OVER (ORDER BY cache_key) AS counter, cache_key FROM %s) WHERE counter > %%s AND COUNTER <= %%s" % table, [cull_num, cull_num + 1]) - else: + else: # This isn't standard SQL, it's likely to break with some non officially supported databases cursor.execute("SELECT cache_key FROM %s ORDER BY cache_key LIMIT 1 OFFSET %%s" % table, [cull_num]) cursor.execute("DELETE FROM %s WHERE cache_key < %%s" % table, [cursor.fetchone()[0]]) diff --git a/django/core/mail/message.py b/django/core/mail/message.py index 831ab5d492..3ec29c36a8 100644 --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -2,13 +2,13 @@ import mimetypes import os import random import time -from email import Charset, Encoders +from email import charset as Charset, encoders as Encoders from email.generator import Generator -from email.MIMEText import MIMEText -from email.MIMEMultipart import MIMEMultipart -from email.MIMEBase import MIMEBase -from email.Header import Header -from email.Utils import formatdate, getaddresses, formataddr, parseaddr +from email.mime.text import MIMEText +from email.mime.multipart import MIMEMultipart +from email.mime.base import MIMEBase +from email.header import Header +from email.utils import formatdate, getaddresses, formataddr, parseaddr from django.conf import settings from django.core.mail.utils import DNS_NAME diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index 952b1cb20a..6b2b9e9b2e 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -78,7 +78,7 @@ class Command(BaseCommand): return zipfile.ZipFile.read(self, self.namelist()[0]) compression_types = { - None: file, + None: open, 'gz': gzip.GzipFile, 'zip': SingleZipReader } diff --git a/django/utils/http.py b/django/utils/http.py index 07e96b9ba6..4fee731d0a 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -4,7 +4,7 @@ import re import sys import urllib import urlparse -from email.Utils import formatdate +from email.utils import formatdate from django.utils.datastructures import MultiValueDict from django.utils.encoding import smart_str, force_unicode