[Mailman-Users] Modifying Privacy.py

Mark Sapiro mark at msapiro.net
Tue Feb 23 19:17:09 EST 2016


On 02/23/2016 03:44 PM, ListGnome ProtonMail via Mailman-Users wrote:
> 
> There are currently three option and I'm trying to remove "Confirm"
> so that the only two options remain - "Require approval" and "Confirm
> and approve".
> 
> In the file "/usr/lib/mailman/Mailman/Gui/Privacy.py" I've tried
> removing the lines that relate to "Confirm" - and as expected the
> Admin page looks okay with only the two desired options showing.
> However, what happens when someone subscribs is they actually get the
> "Confirm" process - rather than the expected "Requires approval".
> 
> Is there another file I need to be looking at also? Or am I most
> likely just screwing up the "Privacy.py" file?


It's much more complicated than that. There are actually four possible
values for subscribe_policy. These values and their meanings are

0 -> Open subscribe, no confirm or approve.
1 -> Confirm, require user confirmation
2 -> Require approval
3 -> Confirm and approve, require user confirmation, then approval

There is already code in Mailman/Gui/Privacy.py to test the
mm_cfg.ALLOW_OPEN_SUBSCRIBE setting and if it is false, not display the
open subscribe choice AND increment the return value allow for it's not
being there.

By removing the "Confirm" choice you are left with two choices whose
returned POST values will be 0 and 1. The mm_cfg.ALLOW_OPEN_SUBSCRIBE
code will increment the return, so the two choices are 1 and 2 which are
'Confirm' and 'Require approval' Regardless of what the words say.

So Assuming you will NEVER set ALLOW_OPEN_SUBSCRIBE = Yes, you can just
change the statement in the definition of _setValue() in
Mailman/Gui/Privacy.py from

        if property == 'subscribe_policy' and not
mm_cfg.ALLOW_OPEN_SUBSCRIBE:
            val += 1

to

        if property == 'subscribe_policy' and not
mm_cfg.ALLOW_OPEN_SUBSCRIBE:
            val += 2


-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list