On 1/17/19 8:45 AM, Nick Wynja wrote:
user_manager = getUtility(IUserManager) u = user_manager.get_user('aperson@example.com') u.addresses[0].display_name = "Anne" commit()
It seems this method updates the display_name for the user across all lists. Is there a way to update just a single instance of "member" of a list rather than the site-wide user?
I've tried this:
mailman shell -l test@example.com
mem = m.members.get_member('a@example.com') mem <Member: a@example.com on test@example.com as MemberRole.member> mem.display_name 'Anne' mem.display_name = "Anne P" Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: can't set attribute
That's because mem.display_name is a "calculated" attribute.
The definition of the IMember class says
display_name = Attribute( """The best match of the member's display name. This will be `subscriber.display_name` if available, which means it will either be the display name of the address or user that's subscribed. If unavailable, and the address is the subscriber, then the linked user's display name is given, if available. When all else fails, the empty string is returned. """)
and
subscriber = Attribute( """The object representing how this member is subscribed. This will be an ``IAddress`` if the user is subscribed via an explicit address, otherwise if the the user is subscribed via their preferred address, it will be an ``IUser``. """)
So there is no member display_name per se. The display_name is the display_name of the associated IUser or IAddress, and these are global.
The bottom line is there is not a way to update just a single instance of "member" of a list rather than the site-wide user or address?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan