Browse files

Fixed a bunch of imports of the email stdlib module now that we are o…

…n Python 2.5 to ease the Python 3 port. Thanks, Martin von Löwis.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 387e192 commit ddaca29d3dc2b4a917a9e527fd90a14ef8bc47e4 @jezdez jezdez committed Sep 9, 2011
5 django/contrib/admindocs/
@@ -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
2 django/contrib/comments/
@@ -4,7 +4,7 @@
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
2 django/core/cache/backends/
@@ -139,7 +139,7 @@ def _cull(self, db, cursor, now):
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]])
12 django/core/mail/
@@ -2,13 +2,13 @@
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
2 django/core/management/commands/
@@ -78,7 +78,7 @@ def read(self):
return, self.namelist()[0])
compression_types = {
- None: file,
+ None: open,
'gz': gzip.GzipFile,
'zip': SingleZipReader
2 django/utils/
@@ -4,7 +4,7 @@
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

0 comments on commit ddaca29

Please sign in to comment.