Code

. stripping of the email message body can now be controlled through
authorrochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 23 Apr 2002 15:46:49 +0000 (15:46 +0000)
committerrochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 23 Apr 2002 15:46:49 +0000 (15:46 +0000)
   the config variables EMAIL_KEEP_QUOTED_TEST and
   EMAIL_LEAVE_BODY_UNCHANGED.

git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@708 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
roundup/mailgw.py
roundup/templates/classic/instance_config.py
roundup/templates/extended/instance_config.py

index 10a2368a2f3a2adab8127ab09b5e18035b8c16bb..1650c3991563fac20f09405b3bb33708be2bfdcf 100644 (file)
@@ -19,6 +19,8 @@ Feature:
      <br>View: <display call="link('superseder', showid=1)">
     </property>
    </td>
      <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
 
 Fixed:
  . stop sending blank (whitespace-only) notes
index 3dbf229ab3294a828e4e87c2f2e7781bfc1db127..c4967728f26bad8bdc267ae0234b68232194b970 100644 (file)
@@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
 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 @@ not find a text/plain part to use.
         else:
             content = self.get_part_data_decoded(message) 
  
         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
 
         # 
         # handle the attachments
@@ -745,8 +748,10 @@ There was a problem with the message you sent:
             # commit the new node(s) to the DB
             self.db.commit()
 
             # 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
     ''' 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 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
                 if line[0] not in '>|':
                     break
             else:
                 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:
                 continue
             # keep this section - it has reponse stuff in it
             if not summary:
@@ -799,10 +804,17 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
 
         # and add the section to the output
         l.append(section)
 
         # 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 $
 
 #
 # $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
 # 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
index d6e76221cd0a66a83b5eb7b65567673d883b40c0..cc57d2aca0565e2740e790261086d7bc865aa349 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # 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
 
 MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
 HTTP_PORT=0
@@ -83,6 +83,12 @@ MESSAGES_TO_AUTHOR = 'no'       # either 'yes' or 'no'
 # Where to place the email signature
 EMAIL_SIGNATURE_POSITION = 'bottom'
 
 # 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:
 # 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 @@ USER_INDEX = {
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $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
 # 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
index b737312cd17dc0b3a139d49934273308e821b9d5..e60c93097b966bc5ec6a727877c74c0142898e0b 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # 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
 
 MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
 HTTP_PORT=0
@@ -83,6 +83,12 @@ MESSAGES_TO_AUTHOR = 'no'       # either 'yes' or 'no'
 # Where to place the email signature
 EMAIL_SIGNATURE_POSITION = 'bottom'
 
 # 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:
 # 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 @@ MY_SUPPORT_INDEX = {
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $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
 # 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