[Mailman-Users] Modifying Privacy.py

ListGnome ProtonMail listgnome at protonmail.ch
Sun Feb 28 18:23:20 EST 2016


Thanks Mark,

That worked, with one little "gotcha". I found that after editing Privacy.py, I had to go to the admin page of the list and although the Privacy option was showing "Requires approval" - until I re-submitted the Privay Options page it would operate as if it were set on "Confirm".

To recap for anyone else interested:

1. Edit /usr/lib/mailman/Mailman/Gui/Privacy.py

ABOUT LINES 77 TO 90, CHANGE:


else:
sub_cfentry = ('subscribe_policy', mm_cfg.Radio,
# choices
(_('Confirm'),
_('Require approval'),
_('Confirm and approve')),
1,
_('What steps are required for subscription?<br>'),
_('''Confirm (*) - email confirmation required <br>
Require approval - require list administrator
approval for subscriptions <br>
Confirm and approve - both confirm and approve


TO:


else:
sub_cfentry = ('subscribe_policy', mm_cfg.Radio,
# choices
(_('Require approval'),
_('Confirm and approve')),
1,
_('What steps are required for subscription?<br>'),
_('''Require approval - require list administrator
approval for subscriptions <br>
Confirm and approve - both confirm and approve



ABOUT LINE 554, CHANGE:

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


2. RESTART MAILMAN

3. Go to the list's admin page and select (re-select) "Require approval"
or "Confirm and approve" and submit the page.


-------- Original Message --------
Subject: Re: [Mailman-Users] Modifying Privacy.py
Local Time: February 24, 2016 11:17 am
UTC Time: February 24, 2016 12:17 AM
From: mark at msapiro.net
To: mailman-users at python.org

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
------------------------------------------------------
Mailman-Users mailing list Mailman-Users at python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: https://mail.python.org/mailman/options/mailman-users/listgnome%40protonmail.ch


More information about the Mailman-Users mailing list