From: schlatterbeck Date: Thu, 21 Oct 2010 20:31:13 +0000 (+0000) Subject: python2.3 compatibility fixes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3279b5cb0212f1ea06c3322d0cc4db8b56e07f8e;p=roundup.git python2.3 compatibility fixes git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4556 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/anypy/email_.py b/roundup/anypy/email_.py new file mode 100644 index 0000000..7a6e1eb --- /dev/null +++ b/roundup/anypy/email_.py @@ -0,0 +1,19 @@ +try: + # Python 2.5+ + from email.parser import FeedParser +except ImportError: + # Python 2.4 + try : + from email.Parser import FeedParser + except ImportError: + from email.Parser import Parser + class FeedParser: + def __init__(self): + self.content = [] + + def feed(self, s): + self.content.append(s) + + def close(self): + p = Parser() + return p.parsestr(''.join(self.content)) diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 3d132ec..1d8c32f 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -158,7 +158,9 @@ class Database(FileStorage, hyperdb.Database, roundupdb.Database): def getclasses(self): """Return a list of the names of all existing classes.""" - return sorted(self.classes) + l = self.classes.keys() + l.sort() + return l def getclass(self, classname): """Get the Class object representing a particular class. diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 09168dd..fd4e0ba 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -31,12 +31,7 @@ from email.Header import Header from email.MIMEText import MIMEText from email.MIMEBase import MIMEBase -try: - # Python 2.5+ - from email.parser import FeedParser -except ImportError: - # Python 2.4 - from email.Parser import FeedParser +from anypy.email_ import FeedParser from roundup import password, date, hyperdb from roundup.i18n import _