[Nym3-commit] r221 - trunk/nym3

jr at conuropsis.org jr at conuropsis.org
Mon May 2 19:19:03 CEST 2005


Author: jr
Date: 2005-05-02 19:19:02 +0200 (Mon, 02 May 2005)
New Revision: 221

Modified:
   trunk/nym3/Mail.py
Log:
Add a method to summarize a synopsis


Modified: trunk/nym3/Mail.py
===================================================================
--- trunk/nym3/Mail.py	2005-05-02 12:17:18 UTC (rev 220)
+++ trunk/nym3/Mail.py	2005-05-02 17:19:02 UTC (rev 221)
@@ -30,6 +30,7 @@
 import random
 import base64
 import string
+import email.Parser
 import nym3.Common as Common
 import nym3.Server.Config as Sconfig
 
@@ -66,6 +67,19 @@
 	
     return res + 'X-Octets: ' + repr(len(msg)) + "\n" + body
 
+def syn_summary(synopsis):
+    """returns a summary for the provided synopsis.
+    """
+    par = email.Parser.HeaderParser()
+    syn = par.parsestr(synopsis)
+    from_f = syn['From']
+    subj_f = syn['Subject']
+    if from_f == None:
+	from_f = ""
+    if subj_f == None:
+	subj_f = ""
+    return "From: %s\nSubject: %s" % (from_f, subj_f)
+
 def tmpFileMsg(body):
     """write body in a temp file name and return a file name of this file
     """



More information about the Nym3-commit mailing list