On Sat, Dec 19, 2020, at 6:55 PM, Andreas Barth wrote:
- Abhilash Raj (maxking@asynchronous.in) [201219 06:28]:
I am just wondering if Core's API should do this (probably not by default, but with a bool parameter that P can use every time), or should we iterate over all addresses and PATCH the display names in them (would be slower, with multiple API requests).
I am leaning towards the first option. What do you think?
I agree to that.
Also, I'm just trying to do a small sync script for the moment (using mailman release 3.3.2) for user in client.users: if not user.display_name: continue for address in user.addresses: if address.display_name == user.display_name: continue address.display_name = user.display_name address.save() and getting the response urllib.error.HTTPError: HTTP Error 405:
Also the server side log doesn't tell me more: [19/Dec/2020:14:00:00 +0100] "PATCH /3.1/addresses/aba@ayous.org HTTP/1.1" 405 0 "-" "GNU Mailman REST client v3.3.2"
Any hint what I'm doing wrong here?
Currently released versions doesn't allow updating Address's display_name (which is the only editable attribute, hence 405 PATCH method not allowed error). This is something that I fixed 3 days back, so it will only be available by next release.
You can iterate over the Users and their addresses in mailman shell
as well:
>>> from mailman.interfaces.usermanager import IUserManager
>>> from zope.component import getUtility
>>> user_manager = getUtility(IUserManager)
>>> for user in user_manager.users:
... for address in user.addresses:
... address.display_name = user.display_name
...
>>> commit()
This should do the same thing you mentioned above I think.
Regards, Andi
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)