Mercurial > p > roundup > code
comparison roundup/mailgw.py @ 389:7d7cb5319fc0
re-open the database as the author in mail handling
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 13 Nov 2001 21:44:44 +0000 |
| parents | be28f4c4feb6 |
| children | 399340646765 |
comparison
equal
deleted
inserted
replaced
| 388:2d92f93072f9 | 389:7d7cb5319fc0 |
|---|---|
| 70 set() method to add the message to the item's spool; in the second case we | 70 set() method to add the message to the item's spool; in the second case we |
| 71 are calling the create() method to create a new node). If an auditor raises | 71 are calling the create() method to create a new node). If an auditor raises |
| 72 an exception, the original message is bounced back to the sender with the | 72 an exception, the original message is bounced back to the sender with the |
| 73 explanatory message given in the exception. | 73 explanatory message given in the exception. |
| 74 | 74 |
| 75 $Id: mailgw.py,v 1.32 2001-11-12 22:04:29 richard Exp $ | 75 $Id: mailgw.py,v 1.33 2001-11-13 21:44:44 richard Exp $ |
| 76 ''' | 76 ''' |
| 77 | 77 |
| 78 | 78 |
| 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri | 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri |
| 80 import traceback | 80 import traceback |
| 112 subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re)\s*\W?\s*)*' | 112 subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re)\s*\W?\s*)*' |
| 113 r'\s*(\[(?P<classname>[^\d]+)(?P<nodeid>\d+)?\])' | 113 r'\s*(\[(?P<classname>[^\d]+)(?P<nodeid>\d+)?\])' |
| 114 r'\s*(?P<title>[^\[]+)(\[(?P<args>.+?)\])?', re.I) | 114 r'\s*(?P<title>[^\[]+)(\[(?P<args>.+?)\])?', re.I) |
| 115 | 115 |
| 116 class MailGW: | 116 class MailGW: |
| 117 def __init__(self, db): | 117 def __init__(self, instance, db): |
| 118 self.instance = instance | |
| 118 self.db = db | 119 self.db = db |
| 119 | 120 |
| 120 def main(self, fp): | 121 def main(self, fp): |
| 121 ''' fp - the file from which to read the Message. | 122 ''' fp - the file from which to read the Message. |
| 122 ''' | 123 ''' |
| 292 | 293 |
| 293 # | 294 # |
| 294 # handle the users | 295 # handle the users |
| 295 # | 296 # |
| 296 author = self.db.uidFromAddress(message.getaddrlist('from')[0]) | 297 author = self.db.uidFromAddress(message.getaddrlist('from')[0]) |
| 298 # reopen the database as the author | |
| 299 username = self.db.user.get(author, 'username') | |
| 300 self.db.close() | |
| 301 self.db = self.instance.open(username) | |
| 302 # now update the recipients list | |
| 297 recipients = [] | 303 recipients = [] |
| 298 tracker_email = self.ISSUE_TRACKER_EMAIL.lower() | 304 tracker_email = self.ISSUE_TRACKER_EMAIL.lower() |
| 299 for recipient in message.getaddrlist('to') + message.getaddrlist('cc'): | 305 for recipient in message.getaddrlist('to') + message.getaddrlist('cc'): |
| 300 if recipient[1].strip().lower() == tracker_email: | 306 if recipient[1].strip().lower() == tracker_email: |
| 301 continue | 307 continue |
| 513 l.append(section) | 519 l.append(section) |
| 514 return summary, '\n\n'.join(l) | 520 return summary, '\n\n'.join(l) |
| 515 | 521 |
| 516 # | 522 # |
| 517 # $Log: not supported by cvs2svn $ | 523 # $Log: not supported by cvs2svn $ |
| 524 # Revision 1.32 2001/11/12 22:04:29 richard | |
| 525 # oops, left debug in there | |
| 526 # | |
| 518 # Revision 1.31 2001/11/12 22:01:06 richard | 527 # Revision 1.31 2001/11/12 22:01:06 richard |
| 519 # Fixed issues with nosy reaction and author copies. | 528 # Fixed issues with nosy reaction and author copies. |
| 520 # | 529 # |
| 521 # Revision 1.30 2001/11/09 22:33:28 richard | 530 # Revision 1.30 2001/11/09 22:33:28 richard |
| 522 # More error handling fixes. | 531 # More error handling fixes. |
