From ddaca29d3dc2b4a917a9e527fd90a14ef8bc47e4 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 9 Sep 2011 16:18:38 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20a=20bunch=20of=20imports=20of=20the=20e?= =?UTF-8?q?mail=20stdlib=20module=20now=20that=20we=20are=20on=20Python=20?= =?UTF-8?q?2.5=20to=20ease=20the=20Python=203=20port.=20Thanks,=20Martin?= =?UTF-8?q?=20von=20L=C3=B6wis.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@16731 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admindocs/utils.py | 5 +++-- django/contrib/comments/forms.py | 2 +- django/core/cache/backends/db.py | 2 +- django/core/mail/message.py | 12 ++++++------ django/core/management/commands/loaddata.py | 2 +- django/utils/http.py | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) 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