Ticket #178: email2trac_178.diff
File email2trac_178.diff, 1.8 KB (added by hju@…, 14 years ago) |
---|
-
(a) email2trac_1.0.0 vs. (b) email2trac_1_0_0_new
a b 85 85 86 86 from datetime import tzinfo, timedelta, datetime 87 87 from trac import config as trac_config 88 import trac.notification as TracNotification 88 89 89 90 # Some global variables 90 91 # 91 92 trac_default_version = '0.11' 92 93 m = None 94 sender_email = '' 93 95 94 96 # A UTC class needed for trac version 0.11, added by 95 97 # tbaschak at ktc dot mb dot ca … … 435 437 """ 436 438 Get the default author name and email address from the message 437 439 """ 440 global sender_email 438 441 439 442 self.email_to = self.email_to_unicode(message['to']) 440 443 self.to_name, self.to_email_addr = email.Utils.parseaddr (self.email_to) … … 445 448 # Trac can not handle author's name that contains spaces 446 449 # 447 450 self.author = self.email_addr 451 sender_email = self.email_addr 448 452 449 453 if self.IGNORE_TRAC_USER_SETTINGS: 450 454 return … … 824 828 # 825 829 if self.notify_template: 826 830 tkt['id'] = self.id 827 changed = True828 831 829 832 # Rewrite the description if we have mailto enabled 830 833 # … … 1451 1454 fd.close() 1452 1455 os.unlink(path) 1453 1456 1454 # Return how many attachments 1457 # Return how many attachments if > 0 or problems with attachment size 1455 1458 # 1459 if status or count > 0: 1456 1460 status = 'This message has %d attachment(s)\n%s' %(count, status) 1457 1461 return status 1458 1462 … … 1499 1503 1500 1504 return project 1501 1505 1506 def WrapNotify(self, resid): 1507 """ 1508 Copy of def notify() to manipulate recipents 1509 """ 1510 (torcpts, ccrcpts) = self.get_recipients(resid) 1511 1512 # additionally append sender (regardeless of settings in trac.ini) 1513 # 1514 torcpts.append(sender_email) 1515 1516 self.begin_send() 1517 self.send(torcpts, ccrcpts) 1518 self.finish_send() 1519 1520 TracNotification.Notify.notify = WrapNotify 1521 1502 1522 1503 1523 if __name__ == '__main__': 1504 1524 # Default config file