Changeset 604


Ignore:
Timestamp:
08/30/12 13:55:54 (12 years ago)
Author:
bas
Message:

applied and modified patch to skip stripping of signatures and quotes, closes #192

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r603 r604  
    3030    Reported by: Anonymous
    3131    Fixed by: Bas van der Vlies
     32
     33  * Added a new option 'only_strip_on_update', default value is False. Only call the functions
     34    strip_quotes and strip_signature for ticket updates, closes #192
     35    Requested by, Patch:  Konstantin Ryabitsev <icon add mricon dot com>
     36    Appplied by: Bas van der Vlies
    3237
    33382.5.0
  • trunk/email2trac.py.in

    r603 r604  
    220220            self.parameters.subject_field_separator = self.parameters.subject_field_separator.strip()
    221221
     222        #if self.parameters.only_strip_on_update == None:
     223        #    self.parameters.only_strip_on_update == False:
     224        #else:
     225        #    self.parameters.only_strip_on_update == True:
     226
    222227        self.trac_smtp_from = self.get_config('notification', 'smtp_from')
    223228        self.smtp_default_domain = self.get_config('notification', 'smtp_default_domain')
     
    979984            ## Not a valid ticket
    980985            #
     986            self.logger.info("\tCreating a new ticket, ticket id: %s does not exists" %id)
    981987            self.id = None
    982988            return False
     
    12401246
    12411247
    1242         message_parts = self.get_message_parts(msg)
     1248        message_parts = self.get_message_parts(msg, True)
    12431249
    12441250        ## Must we update some ticket fields properties via body_text
     
    20082014        return part.get_param('inline', None, 'Content-Disposition') == '' or not part.has_key('Content-Disposition')
    20092015
    2010     def get_message_parts(self, msg):
     2016    def get_message_parts(self, msg, new_email=False):
    20112017        """
    20122018        parses the email message and returns a list of body parts and attachments
     
    21042110            if self.parameters.reflow and not self.parameters.verbatim_format and format == 'flowed':
    21052111                body_text = self.reflow(body_text, delsp == 'yes')
    2106    
    2107             if self.parameters.strip_signature:
    2108                 body_text = self.strip_signature(body_text)
    2109 
    2110             if self.parameters.strip_quotes:
    2111                 body_text = self.strip_quotes(body_text)
     2112
     2113            if new_email and self.parameters.only_strip_on_update:
     2114                self.logger.debug('Skip signature/quote stripping for new messages')
     2115            else:
     2116                if self.parameters.strip_signature:
     2117                    body_text = self.strip_signature(body_text)
     2118
     2119                if self.parameters.strip_quotes:
     2120                    body_text = self.strip_quotes(body_text)
    21122121
    21132122            if self.parameters.inline_properties:
Note: See TracChangeset for help on using the changeset viewer.