Changeset 152 for emailtotracscript/trunk
- Timestamp:
- 04/24/07 07:52:46 (17 years ago)
- Location:
- emailtotracscript/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/ChangeLog
r151 r152 1 2007- 03-091 2007-XXXXX 2 2 3 3 * Added some primarily check to catch an error when attachment size … … 13 13 Author: Rainer Sokoll (r.sokoll at intershop dot de) 14 14 15 16 2007-03-08 Michel Jouvin <jouvin@lal.in2p3.fr>17 15 * email2trac.py : blacklist (don't create ticket) mail from 18 16 MAILER-DAEMON to avoid loops 17 Author: Michel Jouvin <jouvin at lal dot in2p3 dot fr> 18 19 19 * msg.bad.txt : add an example of message from MAILER-DAEMON 20 Author: Michel Jouvin <jouvin at lal dot in2p3 dot fr> 20 21 21 22 2006-12-08 -
emailtotracscript/trunk/email2trac.py.in
r151 r152 41 41 42 42 * From: => Reporter 43 => CC (Optional via reply_a ddressoption)43 => CC (Optional via reply_all option) 44 44 * Subject: => Summary 45 45 * Body => Description … … 53 53 debug : 1 # OPTIONAL, if set print some DEBUG info 54 54 spam_level : 4 # OPTIONAL, if set check for SPAM mail 55 reply_a ddress: 1 # OPTIONAL, if set then fill in ticket CC field55 reply_all : 1 # OPTIONAL, if set then fill in ticket CC field 56 56 umask : 022 # OPTIONAL, if set then use this umask for creation of the attachments 57 57 mailto_link : 1 # OPTIONAL, if set then [mailto:<>] in description … … 416 416 417 417 if self.VERSION == 0.9: 418 s elf.attachments(m, tkt, True)419 else: 420 s elf.attachments(m, tkt)418 str = self.attachments(m, tkt, True) 419 else: 420 str = self.attachments(m, tkt) 421 421 422 422 if self.notification: … … 492 492 %(head, mailto, body_text) 493 493 494 n= self.attachments(msg, tkt)495 if n:494 str = self.attachments(msg, tkt) 495 if str: 496 496 changed = True 497 comment = '%s\n This message has %d attachment(s)\n' %(comment, n)497 comment = '%s\n%s\n' %(comment, str) 498 498 499 499 if changed: … … 522 522 self.db = self.env.get_db_cnx() 523 523 self.get_author_emailaddrs(m) 524 524 525 if self.blacklisted_from(): 525 526 if self.DEBUG > 1 : … … 692 693 first = 0 693 694 number = 0 695 696 # Get Maxium attachment size 697 # 698 max_size = int(self.get_config('attachment', 'max_size')) 699 message = '' 700 694 701 for part in message.walk(): 695 702 if part.get_content_maintype() == 'multipart': # multipart/* is just a container … … 702 709 703 710 filename = part.get_filename() 704 count = count + 1705 711 if not filename: 706 712 number = number + 1 … … 751 757 filesize = stats[stat.ST_SIZE] 752 758 759 # Check if the attachment size is allowed 760 # 761 if file_size > max_size: 762 message = '%s\n%sFile %s is larger then allowed attachment size (%d > %d)' 763 %(message, filename, file_size, max_size) 764 765 os.unlink(path) 766 continue 767 else: 768 count = count + 1 769 753 770 # Insert the attachment it differs for the different TRAC versions 754 771 # … … 779 796 att.description = self.email_to_unicode('Added by email2trac') 780 797 781 try:782 att.insert(url_filename, fd, filesize) 783 except util.TracError, detail:784 a = 1798 att.insert(url_filename, fd, filesize) 799 800 #except util.TracError, detail: 801 # print detail 785 802 786 803 fd.close() … … 792 809 # Return how many attachments 793 810 # 794 return count 811 message = 'This message has %d attachment(s)\n%s' %(count, message) 812 return message 795 813 796 814
Note: See TracChangeset
for help on using the changeset viewer.