summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 615c35a)
raw | patch | inline | side by side (parent: 615c35a)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 3 Aug 2001 07:18:22 +0000 (07:18 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 3 Aug 2001 07:18:22 +0000 (07:18 +0000) |
tests. Also snips signatures now too.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@204 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@204 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
README.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history | |
test/__init__.py | patch | blob | history | |
test/test_mailsplit.py | [new file with mode: 0644] | patch | blob |
diff --git a/CHANGES.txt b/CHANGES.txt
index 938a160bc85f942175244e92d1a88e4017d7733f..27c6f3502003611c166569dc686c6e086db99e39 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
This file contains the changes to the Roundup system over time. The entries
are given with the most recent entry first.
-2001-08-?? - 0.2.5
-Features:
+2001-08-03 - 0.2.5
+Note:
+ . The bsddb3 module has a bug that renders it non-functional. Users should
+ select the anydbm or bsddb backend instead.
Fixed:
+ . Python 2.0 does not contain the unittest module. The setup.py module now
+ checks for unittest before attempting to run the unit tests.
2001-08-03 - 0.2.4
diff --git a/README.txt b/README.txt
index e09fbd11dc91c818382d50268d4ca045f83ec735..ea90cb842c5c5e2ef2721e8eb8970efd8fa197cd 100644 (file)
--- a/README.txt
+++ b/README.txt
roundupdb:
. split the file storage into multiple dirs?
roundup-mailgw:
- . do the "sectioning" stuff properly (ie. as it's documented)
. errors as attachments
- . snip signatures?
roundup-server:
. check the source file timestamps before reloading
cgi_client
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index e6d66cf9c3786ac28ce756d17aca19a1cb28ddb3..8c181aa27c73f4ba798551afb84a22fd269f22f2 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.6 2001-08-01 04:24:21 richard Exp $
+$Id: mailgw.py,v 1.7 2001-08-03 07:18:22 richard Exp $
'''
else:
content = message.fp.read()
- # extract out the summary from the message
- summary = []
- for line in content.split('\n'):
- line = line.strip()
- if summary and not line:
- break
- if not line:
- summary.append('')
- elif line[0] not in '>|':
- summary.append(line)
- summary = '\n'.join(summary)
+ summary, content = parseContent(content)
# handle the files
files = []
props['nosy'].sort()
nodeid = cl.create(**props)
+def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
+ eol=re.compile(r'[\r\n]+'), signature=re.compile(r'^[>|\s]*[-_]+\s*$')):
+ ''' The message body is divided into sections by blank lines.
+ Sections where the second and all subsequent lines begin with a ">" or "|"
+ character are considered "quoting sections". The first line of the first
+ non-quoting section becomes the summary of the message.
+ '''
+ sections = blank_line.split(content)
+ # extract out the summary from the message
+ summary = ''
+ l = []
+ print sections
+ for section in sections:
+ section = section.strip()
+ if not section:
+ continue
+ lines = eol.split(section)
+ if lines[0] and lines[0][0] in '>|':
+ continue
+ if len(lines) > 1 and lines[1] and lines[1][0] in '>|':
+ continue
+ if not summary:
+ summary = lines[0]
+ l.append(section)
+ continue
+ if signature.match(lines[0]):
+ break
+ l.append(section)
+ return summary, '\n'.join(l)
+
#
# $Log: not supported by cvs2svn $
+# Revision 1.6 2001/08/01 04:24:21 richard
+# mailgw was assuming certain properties existed on the issues being created.
+#
# Revision 1.5 2001/07/29 07:01:39 richard
# Added vim command to all source so that we don't get no steenkin' tabs :)
#
diff --git a/test/__init__.py b/test/__init__.py
index 7e841b3f0eb59b508fd50206623ba29342e7882c..5a9df6f50b7d3b51c0d0b22add04da1ac6547bde 100644 (file)
--- a/test/__init__.py
+++ b/test/__init__.py
-# $Id: __init__.py,v 1.3 2001-07-29 07:01:39 richard Exp $
+# $Id: __init__.py,v 1.4 2001-08-03 07:18:22 richard Exp $
import unittest
-import test_dates, test_schema, test_db, test_multipart
+import test_dates, test_schema, test_db, test_multipart, test_mailsplit
def go():
suite = unittest.TestSuite((
test_schema.suite(),
test_db.suite(),
test_multipart.suite(),
+ test_mailsplit.suite(),
))
runner = unittest.TextTestRunner()
runner.run(suite)
#
# $Log: not supported by cvs2svn $
+# Revision 1.3 2001/07/29 07:01:39 richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
+#
# Revision 1.2 2001/07/28 06:43:02 richard
# Multipart message class has the getPart method now. Added some tests for it.
#
diff --git a/test/test_mailsplit.py b/test/test_mailsplit.py
--- /dev/null
+++ b/test/test_mailsplit.py
@@ -0,0 +1,90 @@
+# $Id: test_mailsplit.py,v 1.1 2001-08-03 07:18:22 richard Exp $
+
+import unittest, cStringIO
+
+from roundup.mailgw import parseContent
+
+class MailsplitTestCase(unittest.TestCase):
+ def testPreComment(self):
+ s = '''
+i will have to think about this later...not a 1.0.4 thing I don't
+think...too much thought involved!
+
+issue_tracker@bizarsoftware.com.au wrote:
+> Hey, is there a reason why we can't just leave shop_domain and
+> secure_domain blank and user the REQUEST.whatever_the_machine_name_is
+> for most users? And then specify that if you're going to have
+> secure_domain, you've got to have shop_domain too?
+>
+> -------
+> nosy: richard, tejay
+> ___________________________
+> Roundup issue tracker
+> issue_tracker@bizarsoftware.com.au
+> http://dirk.adroit/cgi-bin/roundup.cgi/issue_tracker/
+
+--
+Terry Kerr (terry@bizarsoftware.com.au)
+Bizar Software Pty Ltd (www.bizarsoftware.com.au)
+Phone: +61 3 9563 4461
+Fax: +61 3 9563 3856
+ICQ: 79303381
+'''
+ summary, content = parseContent(s)
+ print '\n====\n', summary
+ print '====', content
+ print '===='
+
+ def testPostComment(self):
+ s = '''
+issue_tracker@bizarsoftware.com.au wrote:
+> Hey, is there a reason why we can't just leave shop_domain and
+> secure_domain blank and user the REQUEST.whatever_the_machine_name_is
+> for most users? And then specify that if you're going to have
+> secure_domain, you've got to have shop_domain too?
+>
+> -------
+> nosy: richard, tejay
+> ___________________________
+> Roundup issue tracker
+> issue_tracker@bizarsoftware.com.au
+> http://dirk.adroit/cgi-bin/roundup.cgi/issue_tracker/
+
+i will have to think about this later...not a 1.0.4 thing I don't
+think...too much thought involved!
+
+--
+Terry Kerr (terry@bizarsoftware.com.au)
+Bizar Software Pty Ltd (www.bizarsoftware.com.au)
+Phone: +61 3 9563 4461
+Fax: +61 3 9563 3856
+ICQ: 79303381
+'''
+ summary, content = parseContent(s)
+ print '\n====\n', summary
+ print '====', content
+ print '===='
+
+ def testSimple(self):
+ s = '''testing'''
+ summary, content = parseContent(s)
+ print '\n====\n', summary
+ print '====', content
+ print '===='
+
+ def testEmpty(self):
+ s = ''
+ summary, content = parseContent(s)
+ print '\n====\n', summary
+ print '====', content
+ print '===='
+
+def suite():
+ return unittest.makeSuite(MailsplitTestCase, 'test')
+
+
+#
+# $Log: not supported by cvs2svn $
+#
+#
+# vim: set filetype=python ts=4 sw=4 et si