I am using a global ban to stop anyone not in a list of valid domains from being able to subscribe to any of our lists. This ban needs to be maintained using the Mailman3 api as it is being fed from another source.
I can create the ban fine by the following:
from mailmanclient import Client client = Client(URI,apiuser,apipass) client.bans.add("^(?!.*@\.")
client.bans[0].delete() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restbase/base.py",
However, I cannot seem to be able to remove it using the api: line 137, in delete self._connection.call(self._url, method='DELETE') File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restbase/connection.py", line 99, in call raise HTTPError(url, response.status, content, response, None) urllib.error.HTTPError: HTTP Error 404: b''
client.bans.remove(str(client.bans[0])) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restobjects/ban.py",
Or line 83, in remove ban.delete() File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restbase/base.py", line 137, in delete self._connection.call(self._url, method='DELETE') File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restbase/connection.py", line 99, in call raise HTTPError(url, response.status, content, response, None) urllib.error.HTTPError: HTTP Error 404: b''
client.bans.remove("^(?!.*@\.)") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restobjects/ban.py",
Or line 83, in remove ban.delete() File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restbase/base.py", line 137, in delete self._connection.call(self._url, method='DELETE') File "/home/wanout/.local/lib/python3.6/site-packages/mailmanclient/restbase/connection.py", line 99, in call raise HTTPError(url, response.status, content, response, None) urllib.error.HTTPError: HTTP Error 404: b''
And also, when I now try and go into the mailman-core docker image to use the mailman.interfaces.bans, it will not let me see the global bans:
from mailman.interfaces.bans import IBanManager global_bans = IBanManager(None) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: ('Could not adapt', None, <InterfaceClass mailman.interfaces.bans.IBanManager>)
I have opened an issue in Gitlab for this as I feel it may be a bug related to regex and global bans (there was a similar one for list banned addresses): https://gitlab.com/mailman/mailman/issues/598
Many thanks for your time,
--
*Nathan Dixon* MEng Senior Software Architect m: +44 (0)7402 690311
t: +44 (0)20 81231252 e: nathan.dixon@evadon.com w: www.evadon.com
This e-mail and any attachments are confidential and may be protected by legal, professional or other privilege. If you are not the intended recipient you should not store it, copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete your copy from your system. The views expressed are those of the sender and not necessarily those of Evadon. Please note that whilst we scan all e-mails for viruses we cannot guarantee that any e-mail is virus-free. Please be advised that we expressly reserve the right to monitor email content for the purposes of ensuring compliance with legal requirements and company policies and your sending to, or receiving from, us of any email constitutes your agreement to these terms.
Evadon Dynamics Limited, registered in England No. 09494097. Registered Office: Electric Works, Sheffield Digital Campus, 3 Concourse Way, Sheffield, S1 2BJ