Changeset 331
- Timestamp:
- 03/23/10 16:57:23 (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/debian/changelog
r329 r331 1 email2trac (1.3.0- 1) stable; urgency=low1 email2trac (1.3.0-2) stable; urgency=low 2 2 3 3 * Added environment variable INSTALL_USER check. If set then use … … 20 20 Fixed by: Bas van der Vlies 21 21 22 * We do not write any files when dry run mode is enabled. 23 Fixed by: Bas van der Vlies 24 25 * Fixed several issues when DEBUG is enabled with printing no-ascii 26 characters, see #184 27 Reported by: hju add jochenkuhl dot de 28 Fixed by: Bas van der Vlies 29 22 30 -- Bas van der Vlies <basv@sara.nl> Wed, 03 Mar 2010 15:50:35 +0100 23 31 -
trunk/email2trac.py.in
r330 r331 503 503 body_file = os.path.join(self.TMPDIR, 'body.txt') 504 504 505 print 'TD: writing body (%s)' % body_file 506 fx = open(body_file, 'wb') 505 if self.DRY_RUN: 506 print 'DRY-RUN: not saving body to %s' %(body_file) 507 return 508 509 print 'TD: writing body to %s' %(body_file) 510 fx = open(body_file, 'wb') 507 511 if not message_body: 508 message_body = '(None)'512 message_body = '(None)' 509 513 510 514 message_body = message_body.encode('utf-8') … … 525 529 526 530 n = 0 527 for partin message_parts:531 for item in message_parts: 528 532 # Skip inline text parts 529 if not isinstance( part, tuple):533 if not isinstance(item, tuple): 530 534 continue 531 535 532 (original, filename, part) = part536 (original, filename, part) = item 533 537 534 538 n = n + 1 … … 536 540 print 'TD: part%d: filename: %s' % (n, part.get_filename()) 537 541 538 part_file = os.path.join(self.TMPDIR, filename) 539 #part_file = '/var/tmp/part%d' % n 542 part_file = os.path.join(self.TMPDIR, part.get_filename()) 540 543 print 'TD: writing part%d (%s)' % (n,part_file) 544 545 if self.DRY_RUN: 546 print 'DRY_RUN: NOT saving attachments' 547 continue 548 541 549 fx = open(part_file, 'wb') 542 550 text = part.get_payload(decode=1) 551 543 552 if not text: 544 553 text = '(None)' 554 545 555 fx.write(text) 546 556 fx.close() 557 547 558 try: 548 559 os.chmod(part_file,S_IRWXU|S_IRWXG|S_IRWXO) … … 559 570 msg_file = os.path.join(self.TMPDIR, 'msg.txt') 560 571 561 print 'TD: saving email to %s' % msg_file 562 fx = open(msg_file, 'wb') 563 fx.write('%s' % message) 564 fx.close() 565 try: 566 os.chmod(msg_file,S_IRWXU|S_IRWXG|S_IRWXO) 567 except OSError: 568 pass 572 if self.DRY_RUN: 573 print 'DRY_RUN: NOT saving email message to %s' %(msg_file) 574 else: 575 print 'TD: saving email to %s' %(msg_file) 576 577 fx = open(msg_file, 'wb') 578 fx.write('%s' % message) 579 fx.close() 580 581 try: 582 os.chmod(msg_file,S_IRWXU|S_IRWXG|S_IRWXO) 583 except OSError: 584 pass 569 585 570 586 message_parts = self.get_message_parts(message) … … 1058 1074 blog_enabled = True 1059 1075 1060 print m['Subject']1061 1076 if not m['Subject']: 1062 1077 subject = 'No Subject' … … 1326 1341 print 'TD: Filename: %s' % part.get_filename() 1327 1342 except UnicodeEncodeError, detail: 1328 print 'TD: Filename: Can not be printed due to non-asc ci characters'1343 print 'TD: Filename: Can not be printed due to non-ascii characters' 1329 1344 1330 1345 ## Convert 7-bit filename to 8 bits value … … 1341 1356 attachment_names = set() 1342 1357 1343 for partin message_parts:1358 for item in message_parts: 1344 1359 1345 1360 ## If not an attachment, leave it alone 1346 1361 # 1347 if not isinstance( part, tuple):1348 renamed_parts.append( part)1362 if not isinstance(item, tuple): 1363 renamed_parts.append(item) 1349 1364 continue 1350 1365 1351 (filename, part) = part1366 (filename, part) = item 1352 1367 1353 1368 ## If no filename, use a default one … … 1393 1408 1394 1409 if self.DEBUG: 1395 print 'TD: Attachment with filename %s will be saved as %s' % (filename, unique_filename) 1410 try: 1411 print 'TD: Attachment with filename %s will be saved as %s' % (filename, unique_filename) 1412 except UnicodeEncodeError, detail: 1413 print 'Filename can not be printed due to non-ascii characters' 1396 1414 1397 1415 attachment_names.add(unique_filename) … … 1408 1426 1409 1427 if self.DEBUG: 1410 print "TD: attachment_exists: Ticket number : %s, Filename : %s" %(self.id, filename) 1428 s = 'TD: attachment already exists: Ticket id : ' 1429 try: 1430 print "%s%s, Filename : %s" %(s, self.id, filename) 1431 except UnicodeEncodeError, detail: 1432 print "%s%s, Filename : Can not be printed due to non-ascii characters" %(s, self.id) 1411 1433 1412 1434 # We have no valid ticket id
Note: See TracChangeset
for help on using the changeset viewer.