Mercurial > p > roundup > code
diff roundup/configuration.py @ 5117:14abd0a67207
Fix issue934009: Have New Issues Submitted By Email *Not* Change Body!
The mailgw config options: keep_quoted_text and leave_body_unchanged
can now have a new values: new. If set to new, keep_quoted_text acts
like yes if the message is starting a new issue. Otherise it strips
quoted text.
This allows somebody to start a new issue by forwarding
a threaded email (with multiple quoted parts) into roundup and
keeping all the quoted parts. If leave_body_unchanged is set to
new, even the signature on the email that starts a new issue will be
preserved.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 02 Jul 2016 20:05:06 -0400 |
| parents | 96dc9f07340a |
| children | 4058fc1ec746 |
line wrap: on
line diff
--- a/roundup/configuration.py Sat Jul 02 17:55:23 2016 -0400 +++ b/roundup/configuration.py Sat Jul 02 20:05:06 2016 -0400 @@ -293,6 +293,19 @@ else: raise OptionValueError(self, value, self.class_description) +class EmailBodyOption(Option): + + """When to replace message body or strip quoting: always, never or for new items only""" + + class_description = "Allowed values: yes, no, new" + + def str2value(self, value): + _val = value.lower() + if _val in ("yes", "no", "new"): + return _val + else: + raise OptionValueError(self, value, self.class_description) + class IsolationOption(Option): """Database isolation levels""" @@ -760,15 +773,18 @@ "actor from being exposed at mail archives, etc."), ), "Outgoing email options.\nUsed for nozy messages and approval requests"), ("mailgw", ( - (BooleanOption, "keep_quoted_text", "yes", + (EmailBodyOption, "keep_quoted_text", "yes", "Keep email citations when accepting messages.\n" - "Setting this to \"no\" strips out \"quoted\" text" - " from the message.\n" + "Setting this to \"no\" strips out \"quoted\" text\n" + "from the message. Setting this to \"new\" keeps quoted\n" + "text only if a new issue is being created.\n" "Signatures are also stripped.", ["EMAIL_KEEP_QUOTED_TEXT"]), - (BooleanOption, "leave_body_unchanged", "no", - "Preserve the email body as is - that is,\n" - "keep the citations _and_ signatures.", + (EmailBodyOption, "leave_body_unchanged", "no", + "Setting this to \"yes\" preserves the email body\n" + "as is - that is, keep the citations _and_ signatures.\n" + "Setting this to \"new\" keeps the body only if we are\n" + "creating a new issue.", ["EMAIL_LEAVE_BODY_UNCHANGED"]), (Option, "default_class", "issue", "Default class to use in the mailgw\n"
