From 04767c65175f2a76127cd78649c5d92a82a39bb6 Mon Sep 17 00:00:00 2001 From: Nate Case Date: Fri, 22 Aug 2008 15:58:03 -0500 Subject: Add support for Python 2.4 email modules Use email.MIMEText, email.Utils, and email.Header in the case where importing the newer email.mime.text, email.utils, and email.header modules failed. Signed-off-by: Nate Case Signed-off-by: Jeremy Kerr --- apps/patchwork/models.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'apps/patchwork/models.py') diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index eef4b69..d8a9b3f 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -28,8 +28,15 @@ import re import datetime, time import string import random -from email.mime.text import MIMEText -import email.utils + +try: + from email.mime.text import MIMEText + import email.utils +except ImportError: + # Python 2.4 compatibility + from email.MIMEText import MIMEText + import email.Utils + email.utils = email.Utils class Person(models.Model): email = models.CharField(max_length=255, unique = True) -- cgit v1.2.3