diff roundup/anypy/email_.py @ 4447:9d37875416c3

python2.3 compatibility fixes
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Thu, 21 Oct 2010 20:31:13 +0000
parents
children c426cb251bc7
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/roundup/anypy/email_.py	Thu Oct 21 20:31:13 2010 +0000
@@ -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))

Roundup Issue Tracker: http://roundup-tracker.org/