|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: roundupdb.py,v 1.55 2002-06-11 04:58:07 richard Exp $ |
| 18 | +# $Id: roundupdb.py,v 1.56 2002-06-14 03:54:21 dman13 Exp $ |
19 | 19 |
|
20 | 20 | __doc__ = """ |
21 | 21 | Extending hyperdb with types specific to issue-tracking. |
|
24 | 24 | import re, os, smtplib, socket, copy, time, random |
25 | 25 | import MimeWriter, cStringIO |
26 | 26 | import base64, quopri, mimetypes |
| 27 | +import rfc822 |
27 | 28 |
|
28 | 29 | import hyperdb, date |
29 | 30 |
|
@@ -394,7 +395,7 @@ def send_message(self, nodeid, msgid, note, sendto): |
394 | 395 | authname = users.get(authid, 'username') |
395 | 396 | authaddr = users.get(authid, 'address') |
396 | 397 | if authaddr: |
397 | | - authaddr = ' <%s>'%authaddr |
| 398 | + authaddr = rfc822.dump_address_pair( ('',authaddr) ) |
398 | 399 | else: |
399 | 400 | authaddr = '' |
400 | 401 |
|
@@ -440,10 +441,11 @@ def send_message(self, nodeid, msgid, note, sendto): |
440 | 441 | writer = MimeWriter.MimeWriter(message) |
441 | 442 | writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title)) |
442 | 443 | writer.addheader('To', ', '.join(sendto)) |
443 | | - writer.addheader('From', '%s <%s>'%(authname, |
444 | | - self.db.config.ISSUE_TRACKER_EMAIL)) |
445 | | - writer.addheader('Reply-To', '%s <%s>'%(self.db.config.INSTANCE_NAME, |
446 | | - self.db.config.ISSUE_TRACKER_EMAIL)) |
| 444 | + writer.addheader('From', rfc822.dump_address_pair( |
| 445 | + (authname, self.db.config.ISSUE_TRACKER_EMAIL) ) ) |
| 446 | + writer.addheader('Reply-To', rfc822.dump_address_pair( |
| 447 | + (self.db.config.INSTANCE_NAME, |
| 448 | + self.db.config.ISSUE_TRACKER_EMAIL) ) ) |
447 | 449 | writer.addheader('MIME-Version', '1.0') |
448 | 450 | if messageid: |
449 | 451 | writer.addheader('Message-Id', messageid) |
@@ -511,12 +513,25 @@ def send_message(self, nodeid, msgid, note, sendto): |
511 | 513 | def email_signature(self, nodeid, msgid): |
512 | 514 | ''' Add a signature to the e-mail with some useful information |
513 | 515 | ''' |
514 | | - web = self.db.config.ISSUE_TRACKER_WEB + 'issue'+ nodeid |
515 | | - email = '"%s" <%s>'%(self.db.config.INSTANCE_NAME, |
516 | | - self.db.config.ISSUE_TRACKER_EMAIL) |
| 516 | + |
| 517 | + # simplistic check to see if the url is valid, |
| 518 | + # then append a trailing slash if it is missing |
| 519 | + base = self.db.config.ISSUE_TRACKER_WEB |
| 520 | + if not isinstance( base , "" ) or not base.startswith( "http://" ) : |
| 521 | + base = "Configuration Error: ISSUE_TRACKER_WEB isn't a fully-qualified URL" |
| 522 | + elif base[-1] != '/' : |
| 523 | + base += '/' |
| 524 | + web = base + 'issue'+ nodeid |
| 525 | + #web = self.db.config.ISSUE_TRACKER_WEB + 'issue'+ nodeid |
| 526 | + |
| 527 | + # ensure the email address is properly quoted |
| 528 | + email = rfc822.dump_address_pair( self.db.config.INSTANCE_NAME , |
| 529 | + self.db.config.ISSUE_TRACKER_EMAIL ) |
| 530 | + |
517 | 531 | line = '_' * max(len(web), len(email)) |
518 | 532 | return '%s\n%s\n%s\n%s'%(line, email, web, line) |
519 | 533 |
|
| 534 | + |
520 | 535 | def generateCreateNote(self, nodeid): |
521 | 536 | """Generate a create note that lists initial property values |
522 | 537 | """ |
@@ -634,6 +649,9 @@ def generateChangeNote(self, nodeid, oldvalues): |
634 | 649 |
|
635 | 650 | # |
636 | 651 | # $Log: not supported by cvs2svn $ |
| 652 | +# Revision 1.55 2002/06/11 04:58:07 richard |
| 653 | +# detabbing |
| 654 | +# |
637 | 655 | # Revision 1.54 2002/05/29 01:16:17 richard |
638 | 656 | # Sorry about this huge checkin! It's fixing a lot of related stuff in one go |
639 | 657 | # though. |
@@ -815,7 +833,7 @@ def generateChangeNote(self, nodeid, oldvalues): |
815 | 833 | # . Login now takes you to the page you back to the were denied access to. |
816 | 834 | # |
817 | 835 | # Fixed: |
818 | | -# . Lots of bugs, thanks Roché and others on the devel mailing list! |
| 836 | +# . Lots of bugs, thanks Roché and others on the devel mailing list! |
819 | 837 | # |
820 | 838 | # Revision 1.20 2001/11/25 10:11:14 jhermann |
821 | 839 | # Typo fix |
|
0 commit comments