summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5cbcc86)
raw | patch | inline | side by side (parent: 5cbcc86)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 6 Sep 2003 10:21:18 +0000 (10:21 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 6 Sep 2003 10:21:18 +0000 (10:21 +0000) |
the subject line:
-- key <32-char otk, such as Aj4euk4LZSAdwePohj90SME5SpopLETL>.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1859 57a73879-2fb5-44c3-a270-3262357dd7e2
-- key <32-char otk, such as Aj4euk4LZSAdwePohj90SME5SpopLETL>.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1859 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 11cbf7432c4aec0f27359ef92c478808c7a34aa7..1c8bc5d7cea6447475a4368d131fc352b2a50fa1 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.127 2003-09-05 20:56:39 jlgijsbers Exp $
+$Id: mailgw.py,v 1.128 2003-09-06 10:21:18 jlgijsbers Exp $
"""
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
# get the classname
classname = m.group('classname')
if classname is None:
- # no classname, fallback on the default
- if hasattr(self.instance.config, 'MAIL_DEFAULT_CLASS') and \
- self.instance.config.MAIL_DEFAULT_CLASS:
+ # no classname, check if this a registration confirmation email
+ # or fallback on the default class
+ otk_re = re.compile('-- key (?P<otk>[a-zA-Z0-9]{32})')
+ otk = otk_re.search(m.group('title')).group('otk')
+ if otk:
+ self.db.confirm_registration(otk)
+ return
+ elif hasattr(self.instance.config, 'MAIL_DEFAULT_CLASS') and \
+ self.instance.config.MAIL_DEFAULT_CLASS:
classname = self.instance.config.MAIL_DEFAULT_CLASS
else:
# fail
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index 355de47a434eec81c01ad8c9f3fa0057f93648aa..1cc8c85546185bca183f26abc3cb6b7812b6c61e 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.46 2003-05-06 21:49:20 kedder Exp $
+# $Id: test_mailgw.py,v 1.47 2003-09-06 10:21:03 jlgijsbers Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
import rfc822
self.assertEqual(rfc2822.encode_header(ascii_header), ascii_header)
self.assertEqual(rfc2822.encode_header(unicode_header), unicode_encoded)
+ def testRegistrationConfirmation(self):
+ otk = "Aj4euk4LZSAdwePohj90SME5SpopLETL"
+ self.db.otks.set(otk, username='johannes', __time='')
+ message = cStringIO.StringIO('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: Chef <chef@bork.bork.bork>
+To: issue_tracker@your.tracker.email.domain.example
+Cc: richard@test
+Message-Id: <dummy_test_message_id>
+Subject: Re: Complete your registration to Roundup issue tracker\r
+ -- key %s
+
+This is a test confirmation of registration.
+''' % otk)
+ handler = self.instance.MailGW(self.instance, self.db)
+ handler.trapExceptions = 0
+ handler.main(message)
+
+ self.db.user.lookup('johannes')
+
def suite():
l = [unittest.makeSuite(MailgwTestCase),
]
+ l = [MailgwTestCase("testRegistrationConfirmation")]
return unittest.TestSuite(l)