Moderation via command line
I upgraded my server from Debian 12 to Debian 13. This broke several things one of which was mailman. It is now running 3.3.10-2.
The web front end is not usable, it is failing with: django.db.utils.OperationalError: (1054, "Unknown column 'socialaccount_socialapp.provider_id' in 'SELECT'") so I suspect that some mysql tables were not modified.
Anyway, until that is fixed I need to be able to do admin work. I have learned how to use the command line mailman-wrapper to add/remove users - great.
What I need is the ability to see the posts that are held for moderation and release or remove them. Please what command line incantations should I use to do this ?
Thanks in advance.
-- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 https://www.phcomp.co.uk/ Parliament Hill Computers. Registration Information: https://www.phcomp.co.uk/Contact.html #include <std_disclaimer.h>
alain williams writes
I upgraded my server from Debian 12 to Debian 13. This broke several things one of which was mailman. It is now running 3.3.10-2.
The web front end is not usable, it is failing with: django.db.utils.OperationalError: (1054, "Unknown column 'socialaccount_socialapp.provider_id' in 'SELECT'") so I suspect that some mysql tables were not modified.
I remember having seen that, and I got rid of it removeing the the social media in the mailman-web.cfg file.
What I need is the ability to see the posts that are held for moderation and release or remove them. Please what command line incantations should I use to do this ?
This should be in the instructions.
https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/p...
I assume you are using the Debian packaged version...
-- Written by Thomas Krichel http://openlib.org/home/krichel on his 22391st day.
On 9/22/26 17:21, alain williams wrote:
I upgraded my server from Debian 12 to Debian 13. This broke several things one of which was mailman. It is now running 3.3.10-2.
The web front end is not usable, it is failing with: django.db.utils.OperationalError: (1054, "Unknown column 'socialaccount_socialapp.provider_id' in 'SELECT'") so I suspect that some mysql tables were not modified.
You probably need to run Django migrations. I.e. as the mailman user, run
django-admin migrate
where django-admin is the name of your Django admin command.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Thu, Sep 24, 2026 at 04:32:04AM +0200, Thomas Krichel wrote:
alain williams writes
Am I really supposed to understand that post-moderation ? That might be of-use/understandable to someone who understands a bit about mailman3 internals but is obscure to me -- who is just trying to administer mailman.
I think they expect you to be able to run this sort of command line. You can't really do advanced things in Mailman3 without a minimum of python. Mailman2 was much easier. Mailman3 is pretty much a nightmare to run, unless you are a
I assume that it was something to run as python, so I tried it and it failed. I cannot see why it failed:
No, you need to run "mailman shell" and then enter the commands.
Ah, that works, at the 2nd attempt. The first failed as create_list('some-exiting-list@leavesden.org.uk') failed as, not surprisingly the list already existed.
I tried again with a non-existing list - which got created. Fortunately easy to remove with: mailman-wrapper remove non-existing@... I suspect that this create_list() function call is not needed.
The important line is: dump_json('http://localhost:9001/3.0/lists/ant@example.com/held') but substituting one of my lists and changing 9001 to 8001.
dump_json('http://localhost:8001/3.0/lists/my-list@leavesden.org.uk/held/count')
says: count:8
This works without comment: def url(request_id): return ('http://localhost:8001/3.0/lists/' 'my-list@leavesden.org.uk/{0}'.format(request_id))
But: dump_json(url(751)) Says: HTTP Error 404: None
I tried all the request_id:
from mailman.testing.documentation import call_http json = call_http('http://localhost:8001/3.0/lists/my-list@leavesden.org.uk/held')
i=0 while i < len(json['entries']): dump_json(url(json['entries'][i]["request_id"]), { 'action': 'discard', }) i+=1
I am told 8 times:
HTTP Error 404: None
And the count is still 8.
Where is the API for this written down, ie defined, so that I can look at it ?
You told me to Follow: https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/p... which is a few examples, not a definition
Regards
-- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 https://www.phcomp.co.uk/ Parliament Hill Computers. Registration Information: https://www.phcomp.co.uk/Contact.html #include <std_disclaimer.h>
On 9/24/26 09:49, alain williams wrote:
Where is the API for this written down, ie defined, so that I can look at it ?
The API you are looking at is Mailman;'s REST API. It is documented at <https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/r...> of which <https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/p...> is a part.
Following those docs is somewhat tricky as they use helper functions so that the doctests work. In practice, instead of doing something like
json =
call_http('http://localhost:8001/3.0/lists/my-list@leavesden.org.uk/held')
in mailman shell, you would just do
curl -urestadmin:restpass
http://localhost:8001/3.0/lists/my-list@leavesden.org.uk/held
If you want to do these things in mailman shell you're better off
dealing directly with Mailman's models and methods, although
documentation for those things is just the source code.
For example
$ mailman shell -l my-list@leavesden.org.uk
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
The variable 'm' is the test_hold@msapiro.net mailing list
>>> # get the ids of the held messages
>>> for rq in IListRequests(m).held_requests:
... print(rq.id)
...
>>> # The above prints the request IDs. You can then handle them with
>>> from mailman.app.moderator import handle_message
>>> # If you want to discard them all you could do
>>> for rq in IListRequests(m).held_requests:
... handle_message(m, rq.id, Action.discard)
...
>>> # or you could handle them individually with various actions like
>>> # 'accept', 'defer', 'discard' or 'reject'
>>> # and when you're satisfied
>>> commit()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On 9/24/26 11:18, Mark Sapiro wrote:
If you want to do these things in
mailman shellyou're better off dealing directly with Mailman's models and methods, although documentation for those things is just the source code.
But really, rather than doing this at all you should be figuring out how
to fix the web UI. Have you run django_admin migrate? The provider_id
column was added to the socialaccount_socialapp table by
allauth/socialaccount/migrations/0004_app_provider_id_settings.py and
running django_admin migrate should fix this.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (3)
-
alain williams -
Mark Sapiro -
Thomas Krichel