Skip to content

Commit f5f0ee9

Browse files
author
Ralf Schlatterbeck
committed
python2.3 compatibility fixes
1 parent b11b12b commit f5f0ee9

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

roundup/anypy/email_.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
try:
2+
# Python 2.5+
3+
from email.parser import FeedParser
4+
except ImportError:
5+
# Python 2.4
6+
try :
7+
from email.Parser import FeedParser
8+
except ImportError:
9+
from email.Parser import Parser
10+
class FeedParser:
11+
def __init__(self):
12+
self.content = []
13+
14+
def feed(self, s):
15+
self.content.append(s)
16+
17+
def close(self):
18+
p = Parser()
19+
return p.parsestr(''.join(self.content))

roundup/backends/back_anydbm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ def addclass(self, cl):
158158

159159
def getclasses(self):
160160
"""Return a list of the names of all existing classes."""
161-
return sorted(self.classes)
161+
l = self.classes.keys()
162+
l.sort()
163+
return l
162164

163165
def getclass(self, classname):
164166
"""Get the Class object representing a particular class.

roundup/roundupdb.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@
3131
from email.MIMEText import MIMEText
3232
from email.MIMEBase import MIMEBase
3333

34-
try:
35-
# Python 2.5+
36-
from email.parser import FeedParser
37-
except ImportError:
38-
# Python 2.4
39-
from email.Parser import FeedParser
34+
from anypy.email_ import FeedParser
4035

4136
from roundup import password, date, hyperdb
4237
from roundup.i18n import _

0 commit comments

Comments
 (0)