Changeset 139
- Timestamp:
- 12/04/06 12:10:41 (17 years ago)
- Location:
- emailtotracscript/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/ChangeLog
r136 r139 1 1 2XXXXXX 2 2 * email2trac.py: 3 4 3 - Added verbatim_format option default is: 1 4 Added by : Bas van der Vlies 5 5 6 - Added strip_signature option default is: 0 7 Added by : Bas van der Vlies 8 9 - Fixed some unicode errors, thanks to japanes SPAM. 10 If we can not unicode email message then display which 11 charset must be installed in ticket description. Else we 12 trac crashed with unicode errors ;-( 13 Fixed by: Bas van der Vlies 14 15 * delete_spam.py: 16 - Now works for version 0.10 with new API-functions 17 Fixed by: Bas van der Vlies 6 18 7 19 2006-10-27 -
emailtotracscript/trunk/debian/changelog
r132 r139 1 email2trac (0.8.2-2) stable; urgency=low 2 3 * Try new version with unicode fixes 4 5 -- root <root@subtrac.sara.nl> Mon, 4 Dec 2006 12:04:30 +0100 6 1 7 email2trac (0.8.2-1) stable; urgency=low 2 8 -
emailtotracscript/trunk/email2trac.py.in
r138 r139 182 182 self.STRIP_SIGNATURE = 0 183 183 184 185 184 # X-Spam-Score: *** (3.255) BAYES_50,DNS_FROM_AHBL_RHSBL,HTML_ 186 185 # Note if Spam_level then '*' are included … … 198 197 return self.get_config('ticket', 'default_component') 199 198 200 def to_unicode(self,str):199 def email_to_unicode(self, message_str): 201 200 """ 202 201 Email has 7 bit ASCII code, convert it to unicode with the charset … … 204 203 understands it. 205 204 """ 206 results = email.Header.decode_header( str)205 results = email.Header.decode_header(message_str) 207 206 str = None 208 207 for text,format in results: … … 210 209 try: 211 210 temp = unicode(text, format) 212 except (UnicodeError,LookupError):211 except UnicodeError, detail: 213 212 # This always works 214 213 # 215 214 temp = unicode(text, 'iso-8859-15') 215 except LookupError, detail: 216 #text = 'ERROR: Could not find charset: %s, please install' %format 217 #temp = unicode(text, 'iso-8859-15') 218 temp = message_str 219 216 220 else: 217 221 temp = string.strip(text) … … 223 227 str = '%s' %temp 224 228 225 str = str.encode('utf-8')229 #str = str.encode('utf-8') 226 230 return str 227 231 … … 267 271 str = "%s'''Cc:''' %s [[BR]]" % (str, m['Cc']) 268 272 269 #return self.to_unicode(str) 270 return util.text.to_unicode(str) 273 return self.email_to_unicode(str) 271 274 272 275 … … 300 303 self.email_field = users[0] 301 304 else: 302 #self.email_field = self.to_unicode(message['from']) 303 self.email_field = util.text.to_unicode(message['from']) 305 self.email_field = self.email_to_unicode(message['from']) 304 306 305 307 def set_reply_fields(self, ticket, message): … … 335 337 336 338 if mail_list: 337 #ticket['cc'] = self.to_unicode(mail_list) 338 ticket['cc'] = util.text.to_unicode(mail_list) 339 ticket['cc'] = self.email_to_unicode(mail_list) 339 340 340 341 def save_email_for_debug(self, message, tempfile=False): … … 362 363 return False 363 364 else: 364 #subject = self.to_unicode(m['Subject']) 365 subject = util.text.to_unicode(m['Subject']) 365 subject = self.email_to_unicode(m['Subject']) 366 366 367 367 TICKET_RE = re.compile(r""" … … 423 423 tkt['summary'] = u'(geen subject)' 424 424 else: 425 #tkt['summary'] = self.to_unicode(msg['Subject']) 426 tkt['summary'] = util.text.to_unicode(msg['Subject']) 425 tkt['summary'] = self.email_to_unicode(msg['Subject']) 427 426 428 427 … … 470 469 changed = True 471 470 comment = '\nadded mailto line\n' 472 #mailto = self.html_mailto_link(self.to_unicode(msg['subject']), ticket_id, body_text) 473 mailto = self.html_mailto_link(util.text.to_unicode(msg['subject']), ticket_id, body_text) 474 #tkt['description'] = 'email2trac:%s%s\r\n{{{\r\n%s\r\n}}}' %(head, mailto, body_text) 471 mailto = self.html_mailto_link(self.email_to_unicode(msg['subject']), ticket_id, body_text) 475 472 tkt['description'] = 'email2trac:%s%s\r\n%s' %(head, mailto, body_text) 476 473 … … 569 566 570 567 except LookupError, detail: 571 ubody_text = body_text 572 encoding = False 568 ubody_text = 'ERROR: Could not find charset: %s, please install' %(charset) 573 569 574 570 elif part.get_content_type() == 'text/html': … … 632 628 author = self.email_addr 633 629 else: 634 #author = self.to_unicode(self.author) 635 author = util.text.to_unicode(self.author) 630 author = self.email_to_unicode(self.author) 636 631 637 632 # Must find a fix … … 681 676 filename = '%s%s' % (filename, ext) 682 677 else: 683 #filename = self.to_unicode(filename) 684 filename = util.text.to_unicode(filename) 678 filename = self.email_to_unicode(filename) 685 679 686 680 # From the trac code … … 746 740 if not update: 747 741 att.author = self.author 748 #att.description = self.to_unicode('Added by email2trac') 749 att.description = util.text.to_unicode('Added by email2trac') 742 att.description = self.email_to_unicode('Added by email2trac') 750 743 751 744 att.insert(url_filename, fd, filesize) … … 877 870 from trac.web.href import Href 878 871 from trac import util 872 # 873 # return util.text.to_unicode(str) 874 # 879 875 # see http://projects.edgewall.com/trac/changeset/2799 880 876 from trac.ticket.notification import TicketNotifyEmail
Note: See TracChangeset
for help on using the changeset viewer.