summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03a73d6)
raw | patch | inline | side by side (parent: 03a73d6)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 24 Oct 2003 14:59:38 +0000 (14:59 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 24 Oct 2003 14:59:38 +0000 (14:59 +0000) |
space) as a signature starter (bug #827775).
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1928 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1928 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/mailgw.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 8ec27fe983d0e0689a8dc9c233bfbff7369cd855..c4a6780d44b3e589bac5351b6154aeb0a5abf42e 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.133 2003-10-04 11:21:47 jlgijsbers Exp $
+$Id: mailgw.py,v 1.134 2003-10-24 14:59:38 jlgijsbers Exp $
"""
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
def parseContent(content, keep_citations, keep_body,
blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
eol=re.compile(r'[\r\n]+'),
- signature=re.compile(r'^[>|\s]*[-_]+\s*$'),
+ signature=re.compile(r'^[>|\s]*-- $'),
original_msg=re.compile(r'^[>|\s]*-----\s?Original Message\s?-----$')):
''' The message body is divided into sections by blank lines.
Sections where the second and all subsequent lines begin with a ">"
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index 83656fc8835140de2a1d5d17880fe5fae8d7cbfb..152f180efdf612d863ca12fc1f073b978072f8b4 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_mailgw.py,v 1.53 2003-09-15 19:37:28 jlgijsbers Exp $
+# $Id: test_mailgw.py,v 1.54 2003-10-24 14:59:38 jlgijsbers Exp $
import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822
from cStringIO import StringIO
-from roundup.mailgw import MailGW, Unauthorized, uidFromAddress
+from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, parseContent
from roundup import init, instance, rfc2822
NEEDS_INSTANCE = 1
handler.main(message)
self.db.user.lookup('johannes')
-
+
+
+class ParseContentTestCase(unittest.TestCase):
+ def testSignatureRemoval(self):
+ summary, content = parseContent('''Testing, testing.
+
+--
+Signature''', 1, 0)
+ self.assertEqual(content, 'Testing, testing.')
+
+ def testKeepMultipleHyphens(self):
+ body = '''Testing, testing.
+
+----
+Testing, testing.'''
+ summary, content = parseContent(body, 1, 0)
+ self.assertEqual(body, content)
+
def suite():
- l = [unittest.makeSuite(MailgwTestCase),
- ]
+ l = [#unittest.makeSuite(MailgwTestCase),
+ unittest.makeSuite(ParseContentTestCase)]
return unittest.TestSuite(l)