1 # Copyright (C) 2013 W. Trevor King <wking@tremily.us>
3 # This file is part of rss2email.
5 # rss2email is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 2 of the License, or (at your option) version 3 of
10 # rss2email is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # rss2email. If not, see <http://www.gnu.org/licenses/>.
17 """A text-manipulation hook for testing the post-processing infrastructure
20 def _downcase_payload(part):
21 if part.get_content_type() != 'text/plain':
23 payload = part.get_payload()
24 part.set_payload(payload.lower())
26 def downcase_message(message, **kwargs):
27 """Downcase the message body (for testing)
29 if message.is_multipart():
30 for part in message.walk():
31 if part.get_content_type() == 'text/plain':
32 _downcase_payload(part)
34 _downcase_payload(message)