From 9856aaee37c6b5f36847b4fd16996cc8b1cefb58 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 13 Nov 2001 21:44:44 +0000 Subject: [PATCH] . re-open the database as the author in mail handling git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@400 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 2 +- roundup-mailgw | 8 ++++++-- roundup/mailgw.py | 13 +++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 28c3d96..2df05e5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -36,7 +36,7 @@ Fixed: . fixed nosy reaction and author copy handling . errors in nosy reaction will be propogated now (were effectively being squashed) - + . re-open the database as the author in mail handling 2001-10-23 - 0.3.0 pre 3 Feature: diff --git a/roundup-mailgw b/roundup-mailgw index e5a0b65..c4fcc7f 100755 --- a/roundup-mailgw +++ b/roundup-mailgw @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup-mailgw,v 1.13 2001-11-09 01:05:55 richard Exp $ +# $Id: roundup-mailgw,v 1.14 2001-11-13 21:44:44 richard Exp $ import sys, os, re, cStringIO if int(sys.version[0]) < 2: @@ -140,7 +140,7 @@ def main(args): # get a mail handler db = instance.open('admin') - handler = instance.MailGW(db) + handler = instance.MailGW(instance, db) # if there's no more arguments, read a single message from stdin if len(args) == 2: @@ -168,6 +168,10 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.13 2001/11/09 01:05:55 richard +# Fixed bug #479511 ] mailgw to pop once engelbert gruber tested the POP +# gateway. +# # Revision 1.12 2001/11/08 05:16:55 richard # Rolled roundup-popgw into roundup-mailgw. Cleaned mailgw up significantly, # tested unix mailbox some more. POP still untested. diff --git a/roundup/mailgw.py b/roundup/mailgw.py index bb025ff..fa144f6 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -72,7 +72,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.32 2001-11-12 22:04:29 richard Exp $ +$Id: mailgw.py,v 1.33 2001-11-13 21:44:44 richard Exp $ ''' @@ -114,7 +114,8 @@ subject_re = re.compile(r'(?P\s*\W?\s*(fwd|re)\s*\W?\s*)*' r'\s*(?P[^\[]+)(\[(?P<args>.+?)\])?', re.I) class MailGW: - def __init__(self, db): + def __init__(self, instance, db): + self.instance = instance self.db = db def main(self, fp): @@ -294,6 +295,11 @@ Subject was: "%s" # handle the users # author = self.db.uidFromAddress(message.getaddrlist('from')[0]) + # reopen the database as the author + username = self.db.user.get(author, 'username') + self.db.close() + self.db = self.instance.open(username) + # now update the recipients list recipients = [] tracker_email = self.ISSUE_TRACKER_EMAIL.lower() for recipient in message.getaddrlist('to') + message.getaddrlist('cc'): @@ -515,6 +521,9 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'), # # $Log: not supported by cvs2svn $ +# Revision 1.32 2001/11/12 22:04:29 richard +# oops, left debug in there +# # Revision 1.31 2001/11/12 22:01:06 richard # Fixed issues with nosy reaction and author copies. # -- 2.30.2