Changeset 288 for trunk/email2trac.py.in
- Timestamp:
- 10/22/09 18:02:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r287 r288 130 130 self.email_addr = None 131 131 self.email_from = None 132 self.author = No me132 self.author = None 133 133 self.id = None 134 134 … … 344 344 """ 345 345 results = email.Header.decode_header(message_str) 346 s tr= None346 s = None 347 347 for text,format in results: 348 348 if format: … … 362 362 temp = unicode(text, 'iso-8859-15') 363 363 364 if s tr:365 s tr = '%s %s' %(str, temp)364 if s: 365 s = '%s %s' %(s, temp) 366 366 else: 367 s tr= '%s' %temp368 369 #s tr = str.encode('utf-8')370 return s tr367 s = '%s' %temp 368 369 #s = s.encode('utf-8') 370 return s 371 371 372 372 def debug_body(self, message_body, tempfile=False): … … 423 423 Display To and CC addresses in description field 424 424 """ 425 s tr= ''425 s = '' 426 426 #if m['To'] and len(m['To']) > 0 and m['To'] != 'hic@sara.nl': 427 427 if m['To'] and len(m['To']) > 0: 428 s tr= "'''To:''' %s\r\n" %(m['To'])428 s = "'''To:''' %s\r\n" %(m['To']) 429 429 if m['Cc'] and len(m['Cc']) > 0: 430 s tr = "%s'''Cc:''' %s\r\n" % (str, m['Cc'])431 432 return self.email_to_unicode(s tr)430 s = "%s'''Cc:''' %s\r\n" % (s, m['Cc']) 431 432 return self.email_to_unicode(s) 433 433 434 434 … … 519 519 pass 520 520 521 def str_to_dict(self, s tr):522 """ 523 Transfrom a str of the form [<key>=<value>]+ to dict[<key>] = <value>521 def str_to_dict(self, s): 522 """ 523 Transfrom a string of the form [<key>=<value>]+ to dict[<key>] = <value> 524 524 """ 525 525 526 fields = string.split(s tr, ',')526 fields = string.split(s, ',') 527 527 528 528 result = dict() … … 643 643 return False 644 644 645 # How many changes has this ticket 646 cnum = len(tkt.get_changelog()) 647 648 645 649 # reopen the ticket if it is was closed 646 650 # We must use the ticket workflow framework … … 662 666 #print 'get_ticket_changes :', b 663 667 664 if self.WORKFLOW and (self.VERSION in [ '0.11']) :668 if self.WORKFLOW and (self.VERSION in [0.11]) : 665 669 from trac.ticket.default_workflow import ConfigurableTicketWorkflow 666 670 from trac.test import Mock, MockPerm … … 696 700 if body_text.strip() or update_fields: 697 701 if self.DRY_RUN: 698 print 'DRY_RUN: tkt.save_changes(self.author, comment) ', self.author702 print 'DRY_RUN: tkt.save_changes(self.author, body_text, ticket_change_number) ', self.author, cnum 699 703 else: 700 tkt.save_changes(self.author, body_text, when) 704 #tkt.save_changes(self.author, body_text, when) 705 tkt.save_changes(self.author, body_text, when, None, str(cnum)) 706 a =1 707 701 708 702 709 if self.VERSION == 0.9: 703 s tr= self.attachments(message_parts, True)704 else: 705 s tr= self.attachments(message_parts)710 s = self.attachments(message_parts, True) 711 else: 712 s = self.attachments(message_parts) 706 713 707 714 if self.notification and not spam: … … 838 845 %(head, mailto, body_text) 839 846 840 str= self.attachments(message_parts)841 if str:847 has_attachments = self.attachments(message_parts) 848 if has_attachments: 842 849 changed = True 843 comment = '%s\n%s\n' %(comment, str)850 comment = '%s\n%s\n' %(comment, has_attachments) 844 851 845 852 if changed: … … 1376 1383 # use urllib to escape the chars 1377 1384 # 1378 s tr= 'mailto:%s?Subject=%s&Cc=%s' %(1385 s = 'mailto:%s?Subject=%s&Cc=%s' %( 1379 1386 urllib.quote(self.email_addr), 1380 1387 urllib.quote('Re: #%s: %s' %(self.id, subject)), … … 1382 1389 ) 1383 1390 1384 s tr= '\r\n{{{\r\n#!html\r\n<a\r\n href="%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(str, author)1385 return s tr1391 s = '\r\n{{{\r\n#!html\r\n<a\r\n href="%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(str, author) 1392 return s 1386 1393 1387 1394 def attachments(self, message_parts, update=False):
Note: See TracChangeset
for help on using the changeset viewer.