[Mailman-Users] Remove Members waiting for Moderator Approval viaCommand Line

Mark Sapiro mark at msapiro.net
Wed Oct 12 02:51:43 CEST 2011


Phil wrote:
>
>I'm trying to kill a pending subscription to a mailing list via the command
>line because the domain owner forgot to register the main domain of our site
>and we can't approve/deny membership via the web admin interface.
>
>I've tried to remove the e-mail address pending approval via the
>remove_members command and it seem to only react to active and approved
>members of a mailing list.


That's correct. remove_members only removes members. A pending
subscription is not (yet) a member.


>Is there a way to approve / deny a pending user request via shell?


Do you mean a subscription request that is waiting moderator approval
because subscribe_policy is 'Require approval' or 'Confirm and
approve' or one that is waiting user confirmation because
subscribe_policy is 'Confirm' or 'Confirm and approve'? It seems you
mean the former.

Deleting a subscription waiting approval is a multi step process with
existing tools.

First run

/path/to/mailman/bin/dumpdb /path/to/mailman/lists/LISTNAME/pending.pck

This will report something like

[----- start pickle file -----]
<----- start object 1 ----->
{   104: (   2,
             (   1318366634.8118629,
                 'user at example.com',
                 'User Name',
                 'tuufwuge',
                 False,
                 'en')),
    'version': (0, 1)}
[----- end pickle file -----]


There may be more entries than above, but those other than

    'version': (0, 1)

are all pending requests of some kind. Each will have a numeric key,
104 in the above followed by a 2-tuple consisting of a number
indicating the request type (1 for a held message, 2 for a held
subscription or 3 for a held unsubscription) and a tuple of
information the format of which depends on the type.

You are interested in type 2 as above and the information tuple is
(time stamp, e-mail address, real name, password, digest flag,
language). Find the key(s) of the one(s) you want to discard, in the
example above, 104.

Then run 

/path/to/mailman/bin/withlist -l LISTNAME

which will respond

Loading list LISTNAME (locked)
The variable `m' is the LISTNAME MailList instance
>>>

at the >>> prompts, type

>>> from Mailman.mm_cfg import DISCARD
>>> m.HandleRequest(104, DISCARD)

(Use the key from your request instead of 104 - this should not print
any error. You can repeat the above multiple times with other keys if
you have more that one request to discard.)

>>> m.Save()

(This is important to save the state of the list.)

>>>       <- at this prompt type control-D to exit which should respond
Unlocking (but not saving) list: LISTNAME
Finalizing

The discards will be logged in Mailman's vette log.

The above method can be used to discard a held message, but Mailman's
bin/discard is simpler.

-- 
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