summaryrefslogtreecommitdiffstats
path: root/Lib/email/__init__.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-30 01:15:14 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-30 01:15:14 (GMT)
commit8b3febef2f96c35e9aad9db2ef499db040fdefae (patch)
tree6bc3322d80780a8d57d845b350aad9fbe250d5de /Lib/email/__init__.py
parent21b731fb7798218a0e59e6db204d1d43d2a1e820 (diff)
downloadcpython-8b3febef2f96c35e9aad9db2ef499db040fdefae.zip
cpython-8b3febef2f96c35e9aad9db2ef499db040fdefae.tar.gz
cpython-8b3febef2f96c35e9aad9db2ef499db040fdefae.tar.bz2
Copying the email package back, despite its failings.
Diffstat (limited to 'Lib/email/__init__.py')
-rw-r--r--Lib/email/__init__.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/Lib/email/__init__.py b/Lib/email/__init__.py
new file mode 100644
index 0000000..8702212
--- /dev/null
+++ b/Lib/email/__init__.py
@@ -0,0 +1,46 @@
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""A package for parsing, handling, and generating email messages."""
+
+__version__ = '5.0.0'
+
+__all__ = [
+ 'base64mime',
+ 'charset',
+ 'encoders',
+ 'errors',
+ 'generator',
+ 'header',
+ 'iterators',
+ 'message',
+ 'message_from_file',
+ 'message_from_string',
+ 'mime',
+ 'parser',
+ 'quoprimime',
+ 'utils',
+ ]
+
+
+
+# Some convenience routines. Don't import Parser and Message as side-effects
+# of importing email since those cascadingly import most of the rest of the
+# email package.
+def message_from_string(s, *args, **kws):
+ """Parse a string into a Message object model.
+
+ Optional _class and strict are passed to the Parser constructor.
+ """
+ from email.parser import Parser
+ return Parser(*args, **kws).parsestr(s)
+
+
+def message_from_file(fp, *args, **kws):
+ """Read a file and parse its contents into a Message object model.
+
+ Optional _class and strict are passed to the Parser constructor.
+ """
+ from email.parser import Parser
+ return Parser(*args, **kws).parse(fp)