Changeset 100 for emailtotracscript/trunk
- Timestamp:
- 07/14/06 11:02:43 (18 years ago)
- Location:
- emailtotracscript/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/ChangeLog
r99 r100 16 16 mails with fake attachments. 17 17 - It works now for versions higher then 0.8 18 19 * Finally understand the unicode/encode functions and hopefully 20 fixed the errors. 21 Fixed by: Bas van der Vlies 18 22 19 23 2006-07-06 -
emailtotracscript/trunk/debian/changelog
r99 r100 1 email2trac (0.7.6-3) stable; urgency=low 2 3 * Hopefully now fixed the unicode/encode problems 4 5 -- Bas van der Vlies <basv@sara.nl> Fri, 14 Jul 2006 10:59:25 +0200 6 1 7 email2trac (0.7.6-2) stable; urgency=low 2 8 -
emailtotracscript/trunk/email2trac.py.in
r98 r100 198 198 # 199 199 temp = unicode(text, 'iso-8859-15') 200 201 temp = temp.encode('utf-8')202 200 else: 203 201 temp = string.strip(text) … … 205 203 206 204 if str: 207 str = u'%s %s' %(str, temp)205 str = '%s %s' %(str, temp) 208 206 else: 209 str = u'%s' %temp207 str = '%s' %temp 210 208 211 209 str = str.encode('utf-8') … … 423 421 424 422 body_text = self.get_body_text(msg) 425 body_text = ('\r\n'.join(body_text.splitlines())) 426 427 # A patch so that the web-interface will not update the description 428 # field of a ticket 429 # 430 tkt['description'] = u'email2trac:%s\r\n{{{\r\n%s\r\n}}}' \ 423 424 tkt['description'] = 'email2trac:%s\r\n{{{\r\n%s\r\n}}}' \ 431 425 %(head, body_text) 432 426 … … 444 438 # 445 439 if self.MAILTO: 440 changed = True 441 comment = '\nadded mailto line\n' 446 442 mailto = self.html_mailto_link(self.to_unicode(msg['subject']), ticket_id, body_text) 447 tkt['description'] = u'email2trac:%s%s\r\n{{{\r\n%s\r\n}}}' %(head, mailto, body_text) 448 comment = '\nadded mailto line\n' 449 changed = True 443 tkt['description'] = 'email2trac:%s%s\r\n{{{\r\n%s\r\n}}}' %(head, mailto, body_text) 450 444 451 445 n = self.attachments(msg, tkt) 452 446 if n: 447 changed = True 453 448 comment = '%s\nThis message has %d attachment(s)\n' %(comment, n) 454 changed = True455 449 456 450 if changed: … … 499 493 """ 500 494 has_description = 0 495 encoding = True 501 496 ubody_text = u'\r\n{{{\nNo plain text message\n}}}\r\n' 502 497 for part in msg.walk(): … … 515 510 516 511 # Get contents charset (iso-8859-15 if not defined in mail headers) 517 # UTF-8 encode body_text518 512 # 519 charset = part.get_content_charset( 'iso-8859-15')513 charset = part.get_content_charset() 520 514 try: 521 515 ubody_text = unicode(body_text, charset) 522 except (UnicodeError,LookupError): 516 517 except UnicodeError, detail: 523 518 ubody_text = unicode(body_text, 'iso-8859-15') 524 519 520 except LookupError, detail: 521 ubody_text = body_text 522 encoding = False 523 525 524 elif part.get_content_type() == 'text/html': 526 ubody_text = u'\r\n(see attachment for HTML mail message)\r\n'525 ubody_text = '\r\n(see attachment for HTML mail message)\r\n' 527 526 528 527 else: 529 ubody_text = u'\r\n(see attachment for message)\r\n'528 ubody_text = '\r\n(see attachment for message)\r\n' 530 529 531 530 has_description = 1 … … 533 532 534 533 if not has_description: 535 ubody_text = u'\r\n(see attachment for message)\r\n' 536 537 return ubody_text.encode('utf-8') 534 ubody_text = '\r\n(see attachment for message)\r\n' 535 536 # A patch so that the web-interface will not update the description 537 # field of a ticket 538 # 539 ubody_text = ('\r\n'.join(ubody_text.splitlines())) 540 541 # If we can unicode it try to encode it for trac 542 # else we a lot of garbage 543 # 544 if encoding: 545 ubody_text = ubody_text.encode('utf-8') 546 547 return ubody_text 538 548 539 549 def notify(self, tkt , new=True, modtime=0):
Note: See TracChangeset
for help on using the changeset viewer.