Ticket #192: strip-on-update-only.patch

File strip-on-update-only.patch, 1.6 KB (added by Konstantin Ryabitsev <icon@…>, 14 years ago)

Proposed patch to strip quotes and signatures only on ticket update

  • email2trac.py.in

    old new  
    786786                if update_fields:
    787787                        self.update_ticket_fields(tkt, update_fields)
    788788
    789                 message_parts = self.get_message_parts(m)
     789                message_parts = self.get_message_parts(m, is_update=1)
    790790                message_parts = self.unique_attachment_names(message_parts)
    791791
    792792                # Must we update some ticket fields properties via body_text
     
    13381338
    13391339                return part.get_param('inline', None, 'Content-Disposition') == '' or not part.has_key('Content-Disposition')
    13401340
    1341         def get_message_parts(self, msg):
     1341        def get_message_parts(self, msg, is_update=0):
    13421342                """
    13431343                parses the email message and returns a list of body parts and attachments
    13441344                body parts are returned as strings, attachments are returned as tuples of (filename, Message object)
     
    14081408
    14091409                                if self.REFLOW and not self.VERBATIM_FORMAT and format == 'flowed':
    14101410                                        body_text = self.reflow(body_text, delsp == 'yes')
    1411        
    1412                                 if self.STRIP_SIGNATURE:
    1413                                         body_text = self.strip_signature(body_text)
    14141411
    1415                                 if self.STRIP_QUOTES:
    1416                                         body_text = self.strip_quotes(body_text)
     1412                                if is_update:
     1413                                        if self.STRIP_SIGNATURE:
     1414                                                body_text = self.strip_signature(body_text)
     1415                                                if self.DEBUG:
     1416                                                        print 'TD:               Update, stripped signature'
     1417
     1418                                        if self.STRIP_QUOTES:
     1419                                                body_text = self.strip_quotes(body_text)
     1420                                                if self.DEBUG:
     1421                                                        print 'TD:               Update, stripped quotes'
    14171422
    14181423                                if self.INLINE_PROPERTIES:
    14191424                                        body_text = self.inline_properties(body_text)