Modify

Opened 8 years ago

Closed 8 years ago

#296 closed task (fixed)

A small patch that adds a configurable strip_signature_regex

Reported by: steverweber@… Owned by: bas
Priority: major Milestone: strip signature/quotes
Component: email2trac Version: 2.5.0
Keywords: Cc:

Description

Find attached... A small patch that adds a configurable strip_signature_regex

We have been using email2trac for some time and been maintaining a private copy with a small change.. I feel it would be best if it was merged into your version of the.. email2trac.py.in

The attached file is in .py format and differs a little because I just need the simple script..

Anyways it allows email2trac.ini to have a.. strip_signature_regex = -----Original Message-----$|-- $|--$

it adds

    def setup_parameters(self):
        if self.parameters.umask:
            os.umask(self.parameters.umask)
----------
        if not self.parameters.strip_signature_regex:
            self.parameters.strip_signature_regex = '^-----Original Message-----$|^-- $|^--$'
----------

and

    def strip_signature(self, text):
        """
        Strip signature from message, inspired by Mailman software
        """
        self.logger.debug('function strip_signature')

        body = []
        for line in text.splitlines():
----------
            if re.match(self.parameters.strip_signature_regex, line):
----------
                break
            body.append(line)

please merge something along those lines into the trunk/master.. I probably should have compiled the regex instead of using it like i did wasting cpu... but you should get the idea..

Thanks

Attachments (1)

email2trac_custom.py (85.1 KB) - added by steverweber@… 8 years ago.
custom email2trac that adds regex for strip_signature

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by steverweber@…

custom email2trac that adds regex for strip_signature

comment:1 Changed 8 years ago by steverweber@…

  • Milestone set to strip signature/quotes
  • Type changed from defect to task

comment:2 Changed 8 years ago by bas

  • Status changed from new to assigned

Thanks for the patch

comment:3 Changed 8 years ago by anonymous

How can I use the patch?

comment:4 Changed 8 years ago by anonymous

First get the maintainer of this project to merge the change. Then in your email2trac.conf add a strip_signature_regex like.

[DEFAULT]
## strip_signature_regex - requires custom email2trac
strip_signature_regex: ^-----Original Message-----$|^-- $|^--$|^--~$|^.*, Library Systems Support wrote:$
project: /trac/projects/libdev
........

comment:5 Changed 8 years ago by bas

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [606]) added strip_signature_regex option, closes #296, #155

Add Comment

Modify Ticket

Change Properties
Action
as closed The owner will remain bas.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.