Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 5116:0902c046cdd8 | 5117:14abd0a67207 |
|---|---|
| 281 return value.split(',') | 281 return value.split(',') |
| 282 | 282 |
| 283 class RunDetectorOption(Option): | 283 class RunDetectorOption(Option): |
| 284 | 284 |
| 285 """When a detector is run: always, never or for new items only""" | 285 """When a detector is run: always, never or for new items only""" |
| 286 | |
| 287 class_description = "Allowed values: yes, no, new" | |
| 288 | |
| 289 def str2value(self, value): | |
| 290 _val = value.lower() | |
| 291 if _val in ("yes", "no", "new"): | |
| 292 return _val | |
| 293 else: | |
| 294 raise OptionValueError(self, value, self.class_description) | |
| 295 | |
| 296 class EmailBodyOption(Option): | |
| 297 | |
| 298 """When to replace message body or strip quoting: always, never or for new items only""" | |
| 286 | 299 |
| 287 class_description = "Allowed values: yes, no, new" | 300 class_description = "Allowed values: yes, no, new" |
| 288 | 301 |
| 289 def str2value(self, value): | 302 def str2value(self, value): |
| 290 _val = value.lower() | 303 _val = value.lower() |
| 758 "If this is false but add_authorinfo is true, only the name\n" | 771 "If this is false but add_authorinfo is true, only the name\n" |
| 759 "of the actor is added which protects the mail address of the\n" | 772 "of the actor is added which protects the mail address of the\n" |
| 760 "actor from being exposed at mail archives, etc."), | 773 "actor from being exposed at mail archives, etc."), |
| 761 ), "Outgoing email options.\nUsed for nozy messages and approval requests"), | 774 ), "Outgoing email options.\nUsed for nozy messages and approval requests"), |
| 762 ("mailgw", ( | 775 ("mailgw", ( |
| 763 (BooleanOption, "keep_quoted_text", "yes", | 776 (EmailBodyOption, "keep_quoted_text", "yes", |
| 764 "Keep email citations when accepting messages.\n" | 777 "Keep email citations when accepting messages.\n" |
| 765 "Setting this to \"no\" strips out \"quoted\" text" | 778 "Setting this to \"no\" strips out \"quoted\" text\n" |
| 766 " from the message.\n" | 779 "from the message. Setting this to \"new\" keeps quoted\n" |
| 780 "text only if a new issue is being created.\n" | |
| 767 "Signatures are also stripped.", | 781 "Signatures are also stripped.", |
| 768 ["EMAIL_KEEP_QUOTED_TEXT"]), | 782 ["EMAIL_KEEP_QUOTED_TEXT"]), |
| 769 (BooleanOption, "leave_body_unchanged", "no", | 783 (EmailBodyOption, "leave_body_unchanged", "no", |
| 770 "Preserve the email body as is - that is,\n" | 784 "Setting this to \"yes\" preserves the email body\n" |
| 771 "keep the citations _and_ signatures.", | 785 "as is - that is, keep the citations _and_ signatures.\n" |
| 786 "Setting this to \"new\" keeps the body only if we are\n" | |
| 787 "creating a new issue.", | |
| 772 ["EMAIL_LEAVE_BODY_UNCHANGED"]), | 788 ["EMAIL_LEAVE_BODY_UNCHANGED"]), |
| 773 (Option, "default_class", "issue", | 789 (Option, "default_class", "issue", |
| 774 "Default class to use in the mailgw\n" | 790 "Default class to use in the mailgw\n" |
| 775 "if one isn't supplied in email subjects.\n" | 791 "if one isn't supplied in email subjects.\n" |
| 776 "To disable, leave the value blank.", | 792 "To disable, leave the value blank.", |
