Changeset 514 for trunk/email2trac.py.in
- Timestamp:
- 01/14/11 16:16:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r509 r514 415 415 def debug_body(self, message_body, temporary_file=False): 416 416 if temporary_file: 417 body_file = tempfile.mktemp('.email2trac') 417 (fd, body_file) = tempfile.mkstemp('.email2trac') 418 fx = os.fdopen(fd, 'wb') 418 419 else: 419 420 body_file = os.path.join(self.parameters.tmpdir, 'body.txt') 421 fx = open(body_file, 'wb') 420 422 421 423 if self.parameters.dry_run: … … 424 426 425 427 print 'writing body to %s' %(body_file) 426 fx = open(body_file, 'wb')427 428 if not message_body: 428 429 message_body = '(None)' … … 490 491 491 492 if create_tempfile: 492 msg_file = tempfile.mktemp('.email2trac') 493 (fd, msg_file) = tempfile.mkstemp('.email2trac') 494 fx = os.fdopen(fd, 'wb') 493 495 else: 494 496 #msg_file = '/var/tmp/msg.txt' 495 497 msg_file = os.path.join(self.parameters.tmpdir, 'msg.txt') 498 fx = open(msg_file, 'wb') 496 499 497 500 if self.parameters.dry_run: … … 500 503 print 'saving email to %s' %(msg_file) 501 504 502 fx = open(msg_file, 'wb')503 505 fx.write('%s' % message) 504 506 fx.close() … … 537 539 temp = unicode(text, 'iso-8859-15') 538 540 except LookupError, detail: 539 #text = 'ERROR: Could not find charset: %s, please install' %format 541 msg = 'ERROR: Could not find charset: %s, please install' %format 542 sys.logger.error(msg) 540 543 #temp = unicode(text, 'iso-8859-15') 541 544 temp = message_str … … 614 617 parsed_data = None 615 618 if self.parameters.html2text_cmd: 616 tmp_file = tempfile.mktemp('email2trac.html') 619 (fd, tmp_file) = tempfile.mkstemp('email2trac.html') 620 f = os.fdopen(fd, 'w') 621 617 622 cmd = '%s %s' %(self.parameters.html2text_cmd, tmp_file) 618 623 self.logger.debug('\t html2text conversion %s'%(cmd)) … … 622 627 623 628 else: 624 f = open(tmp_file, "w+")625 629 f.write(data) 626 630 f.close()
Note: See TracChangeset
for help on using the changeset viewer.