Mercurial > p > roundup > code
changeset 694:34dbcdfb2fe1
stripping of email message body can be controlled through config variables...
...EMAIL_KEEP_QUOTED_TEST and EMAIL_LEAVE_BODY_UNCHANGED.
| author | Roche Compaan <rochecompaan@users.sourceforge.net> |
|---|---|
| date | Tue, 23 Apr 2002 15:46:49 +0000 |
| parents | 509a101305da |
| children | d524e5b52061 |
| files | CHANGES.txt roundup/mailgw.py roundup/templates/classic/instance_config.py roundup/templates/extended/instance_config.py |
| diffstat | 4 files changed, 42 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Mon Apr 15 23:25:15 2002 +0000 +++ b/CHANGES.txt Tue Apr 23 15:46:49 2002 +0000 @@ -19,6 +19,8 @@ <br>View: <display call="link('superseder', showid=1)"> </property> </td> + . stripping of the email message body can now be controlled through the + config variables EMAIL_KEEP_QUOTED_TEXT and EMAIL_LEAVE_BODY_UNCHANGED. Fixed: . stop sending blank (whitespace-only) notes
--- a/roundup/mailgw.py Mon Apr 15 23:25:15 2002 +0000 +++ b/roundup/mailgw.py Tue Apr 23 15:46:49 2002 +0000 @@ -73,7 +73,7 @@ an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.66 2002-03-14 23:59:24 richard Exp $ +$Id: mailgw.py,v 1.67 2002-04-23 15:46:49 rochecompaan Exp $ ''' @@ -597,7 +597,10 @@ else: content = self.get_part_data_decoded(message) - summary, content = parseContent(content) + keep_citations = self.instance.EMAIL_KEEP_QUOTED_TEXT == 'yes' + keep_body = self.instance.EMAIL_LEAVE_BODY_UNCHANGED == 'yes' + summary, content = parseContent(content, keep_citations, + keep_body) # # handle the attachments @@ -745,8 +748,10 @@ # commit the new node(s) to the DB self.db.commit() -def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'), - eol=re.compile(r'[\r\n]+'), signature=re.compile(r'^[>|\s]*[-_]+\s*$')): +def parseContent(content, keep_citations, keep_body, + blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'), + eol=re.compile(r'[\r\n]+'), + signature=re.compile(r'^[>|\s]*[-_]+\s*$')): ''' The message body is divided into sections by blank lines. Sections where the second and all subsequent lines begin with a ">" or "|" character are considered "quoting sections". The first line of the first @@ -778,9 +783,9 @@ if line[0] not in '>|': break else: - # TODO: people who want to keep quoted bits will want the - # next line... - # l.append(section) + # we keep quoted bits if specified in the config + if keep_citations: + l.append(section) continue # keep this section - it has reponse stuff in it if not summary: @@ -799,10 +804,17 @@ # and add the section to the output l.append(section) - return summary, '\n\n'.join(l) + # we only set content for those who want to delete cruft from the + # message body, otherwise the body is left untouched. + if not keep_body: + content = '\n\n'.join(l) + return summary, content # # $Log: not supported by cvs2svn $ +# Revision 1.66 2002/03/14 23:59:24 richard +# . #517734 ] web header customisation is obscure +# # Revision 1.65 2002/02/15 00:13:38 richard # . #503204 ] mailgw needs a default class # - partially done - the setting of additional properties can wait for a
--- a/roundup/templates/classic/instance_config.py Mon Apr 15 23:25:15 2002 +0000 +++ b/roundup/templates/classic/instance_config.py Tue Apr 23 15:46:49 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: instance_config.py,v 1.13 2002-03-14 23:59:24 richard Exp $ +# $Id: instance_config.py,v 1.14 2002-04-23 15:46:49 rochecompaan Exp $ MAIL_DOMAIN=MAILHOST=HTTP_HOST=None HTTP_PORT=0 @@ -83,6 +83,12 @@ # Where to place the email signature EMAIL_SIGNATURE_POSITION = 'bottom' +# Keep email citations +EMAIL_KEEP_QUOTED_TEXT = 'no' + +# Preserve the email body as is +EMAIL_LEAVE_BODY_UNCHANGED = 'no' + # Default class to use in the mailgw if one isn't supplied in email # subjects. To disable, comment out the variable below or leave it blank. # Examples: @@ -144,6 +150,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.13 2002/03/14 23:59:24 richard +# . #517734 ] web header customisation is obscure +# # Revision 1.12 2002/02/15 00:13:38 richard # . #503204 ] mailgw needs a default class # - partially done - the setting of additional properties can wait for a
--- a/roundup/templates/extended/instance_config.py Mon Apr 15 23:25:15 2002 +0000 +++ b/roundup/templates/extended/instance_config.py Tue Apr 23 15:46:49 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: instance_config.py,v 1.13 2002-03-14 23:59:24 richard Exp $ +# $Id: instance_config.py,v 1.14 2002-04-23 15:46:49 rochecompaan Exp $ MAIL_DOMAIN=MAILHOST=HTTP_HOST=None HTTP_PORT=0 @@ -83,6 +83,12 @@ # Where to place the email signature EMAIL_SIGNATURE_POSITION = 'bottom' +# Keep email citations +EMAIL_KEEP_QUOTED_TEXT = 'no' + +# Preserve the email body as is +EMAIL_LEAVE_BODY_UNCHANGED = 'no' + # Default class to use in the mailgw if one isn't supplied in email # subjects. To disable, comment out the variable below or leave it blank. # Examples: @@ -181,6 +187,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.13 2002/03/14 23:59:24 richard +# . #517734 ] web header customisation is obscure +# # Revision 1.12 2002/02/15 00:13:38 richard # . #503204 ] mailgw needs a default class # - partially done - the setting of additional properties can wait for a
