Projects
Kolab:16:Testing:Candidate
pykolab
0001-Add-footer_sender_exceptions-option-T85056...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Add-footer_sender_exceptions-option-T850567.patch of Package pykolab
From a9f988dad24b43d3af1da6a009cb4d14a22c9204 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <machniak@kolabsys.com> Date: Wed, 26 Jul 2023 15:27:42 +0200 Subject: [PATCH 1/6] Add footer_sender_exceptions option (T850567) Summary: Example: `footer_sender_exceptions = NONE, *.kolab.ch, kolab.ch` Reviewers: #pykolab_developers, mollekopf Reviewed By: #pykolab_developers, mollekopf Subscribers: mollekopf, #pykolab_developers Differential Revision: https://git.kolab.org/D4463 --- wallace/module_footer.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wallace/module_footer.py b/wallace/module_footer.py index 96e8cf6..75b7029 100644 --- a/wallace/module_footer.py +++ b/wallace/module_footer.py @@ -114,6 +114,23 @@ def execute(*args, **kw): footer_position = conf.get('wallace', 'footer_position') footer_html_file = conf.get('wallace', 'footer_html') footer_text_file = conf.get('wallace', 'footer_text') + sender_exceptions = conf.get('wallace', 'footer_sender_exceptions') + + if sender_exceptions: + sender = message.get("X-Kolab-From") + log.debug("Checking sender %r" % (sender), level=8) + + if sender: + for item in sender_exceptions.split(','): + item = item.strip() + regex = '@' + item.replace('*', '[^@]+').replace('.', '\\.') + '$' + if item == 'NONE': + regex = '^<>$' + + if re.search(regex, sender): + log.debug("Sender matches exception %s" % (item), level=8) + exec('modules.cb_action_%s(%r, %r)' % ('ACCEPT','footer', filepath)) + return if not os.path.isfile(footer_text_file) and not os.path.isfile(footer_html_file): log.warning(_("No contents configured for footer module")) -- 2.41.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.