Changeset 607


Ignore:
Timestamp:
08/30/12 15:31:46 (12 years ago)
Author:
bas
Message:

email_quote can now handle regular expression, closes #173
-- This line, and those below, will be ignored--

M email2trac.py.in
M ChangeLog?

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r606 r607  
    3737
    3838  * Added a new option 'strip_signature_regex', default value:
    39       * '^-----Original Message-----$|^-- $'
     39      * strip_signature_regex : ^-----Original Message-----$|^-- $
    4040    This will strip signatures form the email messages. People can set their own regular
    4141    expressions, closes #296, #155
    4242    Author: steverweber add gmail dot com
    43     Appplied by: Bas van der Vlies
     43    Applied by: Bas van der Vlies
     44
     45  * email_quote can now handle regular expresions, default is:
     46        email_quote : ^> .*
     47    We now use the re.match function instead of line.startswith, closes #173
     48    Suggested/Patch by: samuel add hoffstaetter dot com
     49    Applied by: Bas van der Vlies
    4450
    45512.5.0
  • trunk/email2trac.py.in

    r606 r607  
    182182
    183183        if not self.parameters.email_quote:
    184             self.parameters.email_quote = '> '
     184            self.parameters.email_quote = '^> .*'
    185185
    186186        if not self.parameters.ticket_update_by_subject_lookback:
     
    18761876        Strip signature from message, inspired by Mailman software
    18771877        """
    1878         self.logger.debug('function strip_signature')
     1878        self.logger.debug('function strip_signature: %s' %self.parameters.strip_signature_regex)
    18791879
    18801880        body = []
     
    19381938        Strip quotes from message by Nicolas Mendoza
    19391939        """
    1940         self.logger.debug('function strip_quotes')
     1940        self.logger.debug('function strip_quotes: %s' %self.parameters.email_quote)
    19411941
    19421942        body = []
     1943
     1944        STRIP_RE = re.compile( self.parameters.email_quote )
     1945
    19431946        for line in text.splitlines():
     1947
    19441948            try:
    19451949
    1946                 if line.startswith(self.parameters.email_quote):
     1950                match = STRIP_RE.match(line)
     1951                if match:
     1952                    print line
    19471953                    continue
    19481954
     
    19501956
    19511957                tmp_line = self.email_to_unicode(line)
    1952                 if tmp_line.startswith(self.parameters.email_quote):
     1958
     1959                match = STRIP_RE.match(tmp_line)
     1960                if match:
     1961                    print line
    19531962                    continue
    19541963               
Note: See TracChangeset for help on using the changeset viewer.