Code

python2.3 compatibility fixes
authorschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 21 Oct 2010 20:31:13 +0000 (20:31 +0000)
committerschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 21 Oct 2010 20:31:13 +0000 (20:31 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4556 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/anypy/email_.py [new file with mode: 0644]
roundup/backends/back_anydbm.py
roundup/roundupdb.py

diff --git a/roundup/anypy/email_.py b/roundup/anypy/email_.py
new file mode 100644 (file)
index 0000000..7a6e1eb
--- /dev/null
@@ -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))
index 3d132ec672062730b2446ee3dd1ac6d369588ed2..1d8c32f00a8dde6692270e3982f52acd3fbee842 100644 (file)
@@ -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.
index 09168ddf0e4ced405780bd31a1077d9135bd805a..fd4e0ba6c33b0e6615d73e5b86f1664af2218cc4 100644 (file)
@@ -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 _