Re: [Mailman-Users] View a user's subscription options

2015-12-10 Thread Adrian Pepper
 I see https://www.msapiro.net/scripts/user_options lists subscribed topics.
 Which is something of interest.  But it must be run from the server.
 
 I ended up taking my own approach, building on little things I'd written
 before, to do an assessment of topic subscriptions from a web client machine.
 
 Does the following mimic some standard utility somewhere?
 
#
# tag-filter
# From HTML input, output lines of only text or a single tags.
#
 
 I.e. it will produce...
 (e.g. from output of
 curl -s -b cookiefile 
https://mailman/mailman/options/test-aharper-subset/aharper--at--dt.uwaterloo.ca
  )
 
 
 
 
 
 aharper at dt.uwaterloo.ca membership configuration for test-aharper-subset
 
 
 
 
 
 
 
 
 test-aharper-subset mailing list membership configuration for
 aharper at dt.uwaterloo.ca
 
 [...]
 
 
 
 
 
 
 
 
 [...]
 
 
 That can simplify rudimentary parsing.
 
 After tag-filter, I can use my "form-filter", which from output such as
 the above can produce...
 
ahar...@dt.uwaterloo.ca.disablemail="0"(CHECKED)
ahar...@dt.uwaterloo.ca.disablemail="1"(notchecked)
ahar...@dt.uwaterloo.ca.deliver-globally="1"(notchecked)
ahar...@dt.uwaterloo.ca.digest="0"(CHECKED)
ahar...@dt.uwaterloo.ca.digest="1"(notchecked)
ahar...@dt.uwaterloo.ca.mime="0"(notchecked)
ahar...@dt.uwaterloo.ca.mime="1"(CHECKED)
ahar...@dt.uwaterloo.ca.mime-globally="1"(notchecked)
ahar...@dt.uwaterloo.ca.dontreceive="1"(notchecked)
ahar...@dt.uwaterloo.ca.dontreceive="0"(CHECKED)
ahar...@dt.uwaterloo.ca.ackposts="0"(CHECKED)
ahar...@dt.uwaterloo.ca.ackposts="1"(notchecked)
ahar...@dt.uwaterloo.ca.remind="1"(notchecked)
ahar...@dt.uwaterloo.ca.remind="0"(CHECKED)
ahar...@dt.uwaterloo.ca.remind-globally="1"(notchecked)
ahar...@dt.uwaterloo.ca.conceal="0"(notchecked)
ahar...@dt.uwaterloo.ca.conceal="1"(CHECKED)
ahar...@dt.uwaterloo.ca.usertopic="Newsletter%2C"(notchecked)
ahar...@dt.uwaterloo.ca.usertopic="Test+Topic+2%2C"(notchecked)
ahar...@dt.uwaterloo.ca.usertopic="Any+Topic%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="This+Topic+Should+Match+Nothing%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="This+Topic+Should+Match+Everything%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="Farmers+Institute+Newsletters+1%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="Farmers+Institute+Newsletters+2%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="Farmers+Institute+Newsletters+3%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="Farmers+Institute+Newsletters+4%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="Farmers+Institute+Newsletters+5%2C"(notchecked)

ahar...@dt.uwaterloo.ca.usertopic="Farmers+Institute+Newsletters+6%2C"(notchecked)
ahar...@dt.uwaterloo.ca.usertopic="NothingPythonOrg%2C"(notchecked)
ahar...@dt.uwaterloo.ca.usertopic="NothingMine%2C"(notchecked)
ahar...@dt.uwaterloo.ca.rcvtopic="0"(CHECKED)
ahar...@dt.uwaterloo.ca.rcvtopic="1"(notchecked)
ahar...@dt.uwaterloo.ca.nodupes="0"(CHECKED)
ahar...@dt.uwaterloo.ca.nodupes="1"(notchecked)
ahar...@dt.uwaterloo.ca.nodupes-globally="1"(notchecked)
ahar...@dt.uwaterloo.ca.options-submit="Submit My Changes"
 
 (Both tag-filter and form-filter may make simplifying assumptions based
 on what has and has never been seen as mailman HTML, e.g. on what to use
 as "form name").
 
 After turning a simple pipeline like that into "mailman-get-member-options"
 and writing something to do:
 
 get-member-list $listname | \
xargs -n 1 mailman-get-member-options $listname
 
 I added that to what I run in  my standard list dumps.
 
 Allowing me to assess...
 (relevant output is distributed into */members.optioned)
 
 cs-xh-admin% grep topic= */*optioned | sed 's/^[^:]*:.*[.]//' | sort | uniq -c 
| sort -nr
1063 rcvtopic="1"(notchecked)
1063 rcvtopic="0"(CHECKED)
 104 usertopic="Topic+Which+Gets+No+Posts"(notchecked)
 102 usertopic="Farmers+Institute+Newsletters"(notchecked)
   4 usertopic="This+Topic+Should+Match+Nothing%2C"(notchecked)
   4 usertopic="This+Topic+Should+Match+Everything%2C"(notchecked)
   4 usertopic="Test+Topic+2%2C"(notchecked)
   4 usertopic="SCS+Newsletter%2C"(notchecked)
   4 usertopic="NothingPythonOrg%2C"(notchecked)
   4 usertopic="NothingMine%2C"(notchecked)
   4 usertopic="Farmers+Institute+Newsletters+6%2C"(notchecked)
   4 usertopic="Farmers+Institute+Newsletters+5%2C"(notchecked)
   4 usertopic="Farmers+Institute+Newsletters+4%2C"(notchecked)
   4 usertopic="Farmers+Institute+Newsletters+3%2C"(notchecked)
   4 usertopic="Farmers+Institute+Newsletters+2%2C"(notchecked)
   4 usertopic="Farmers+Institute+Newsletters+1%2C"(notchecked)
   4 usertopic="Any+Topic%2C"(notchecked)
   2 usertopic="Farmers+Institute+Newsletters"(CHECK

Re: [Mailman-Users] View a user's subscription options

2015-12-03 Thread Mark Sapiro
On 12/03/2015 01:09 PM, Adrian Pepper wrote:
> 
>  I wrote something (really ugly[*], incrementally developed over a period
>  of weeks) that produced, based on the main "membership" page(s) that
>  produced via web access, e.g.
> 
>  apep...@pytone.org smHxanudP "Adrian Pepper"
>  apep...@pyttwo.org smHxAnuDP "Adrian Pepper again"
>  em...@pytone.org smHxanudP "Empty Recipient List"
>  mshap...@pytone.org smHxanudP "Mark Shapiro"
>  onaf...@pytthree.org smHXanudP "Oscar Nafees"
> 
>  those letter options correspond to reading across on
>  https://SERVER/mailman/admin/LISTNAME/members
>  sort of like "ls gone a little crazy".
> 
>s/S - subscribe/unsubscribe (not actually implemented, for "safety")
> (though I did once in a test version when it would be useful)
>m/M - moderation off/ON
>h/H - hidden off/ON
>x/X - nomail off/ON (reason lost)
>a/A - ack off/ON
>n/N - not metoo off/ON
>u/U - nodUpes off/ON (ahem!)
>d/D - digest off/ON
>p/P - plaintext off/ON (applies to digest only)
> 
>  Needs a cookie file for access.  Vulnerable to formatting changes in
>  the web page output, of course.


You might be interested in looking at
 which is
another web admin membership screenscraper which when run with the --csv
option produces output like


> "Full name","email address","mod","hide","nomail","ack","not 
> metoo","nodupes","digest","plain"
> "Mark 
> Sapiro","m...@msapiro.net","off","off","off","off","off","on","off","off"
> "Mark","another@address","off","off","[A]","off","off","on","off","off"
> "Mark","yet@another","off","off","[A]","off","on","on","off","off"


It uses Python's cookielib to deal with cookies and only requires the
hostname, listname and admin password for input.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@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/archive%40jab.org


Re: [Mailman-Users] View a user's subscription options

2015-12-03 Thread Adrian Pepper
On 12/01/2015 17:23:58 -0800, Mark Sapiro wrote:
> On 12/01/2015 08:51 AM, Gretchen R Beck wrote:
> > Is there a command line script that can be used to view an individual 
> > user's subscription options for a specific list?
> 
> 
> I'm not aware of one, but it is fairly simple to do. I'm willing to add
> it to the collection at , but what do
> you want in the way of output. Presumably the input would be something like
> 
> get_user_options listname u...@example.com
> 
> but what kind of output are you looking for? What fields and in what format?
> 

 I wrote something (really ugly[*], incrementally developed over a period
 of weeks) that produced, based on the main "membership" page(s) that
 produced via web access, e.g.

 apep...@pytone.org smHxanudP "Adrian Pepper"
 apep...@pyttwo.org smHxAnuDP "Adrian Pepper again"
 em...@pytone.org smHxanudP "Empty Recipient List"
 mshap...@pytone.org smHxanudP "Mark Shapiro"
 onaf...@pytthree.org smHXanudP "Oscar Nafees"

 those letter options correspond to reading across on
 https://SERVER/mailman/admin/LISTNAME/members
 sort of like "ls gone a little crazy".

   s/S - subscribe/unsubscribe (not actually implemented, for "safety")
(though I did once in a test version when it would be useful)
   m/M - moderation off/ON
   h/H - hidden off/ON
   x/X - nomail off/ON (reason lost)
   a/A - ack off/ON
   n/N - not metoo off/ON
   u/U - nodUpes off/ON (ahem!)
   d/D - digest off/ON
   p/P - plaintext off/ON (applies to digest only)

 Needs a cookie file for access.  Vulnerable to formatting changes in
 the web page output, of course.

 I actually have something to take that output as input and "make it so".
 But with at least one bug. (Omitted option letters are turned off, not
 left unchanged).

 But my main goal was to monitor changes, especially "nomail", and
 the email address which was supposed to conform to a standard.

 Though the "make it so" script is actually used for doing remote (web)
 subscriptions, setting desired options and a standard name field.

 And much later I realized that that output includes only some of the
 options available to the user on the user options page.

https://SERVER/mailman/options/LISTNAME

 I guess you're talking about running the command on the server?  I don't
 know if you want to contemplate something like my "ls gone a little crazy",
 or not.


Adrian.
[*] Lots of analysis done in csh in the top-level csh script

--
Mailman-Users mailing list Mailman-Users@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/archive%40jab.org


Re: [Mailman-Users] View a user's subscription options

2015-12-03 Thread Mark Sapiro
On 12/03/2015 06:21 AM, Larry Kuenning wrote:
> 
> I tried this and got:
> 
> [root@xxx mailman]# bin/user_options -h
> Traceback (most recent call last):
>   File "bin/user_options", line 98, in ?
> main()
>   File "bin/user_options", line 52, in main
> ns, args = parseargs()
>   File "bin/user_options", line 38, in parseargs
> formatter=optparse.IndentedHelpFormatter())
> TypeError: __init__() got an unexpected keyword argument 'epilog'
> 
> This is under Python 2.4.3.  (Should the file be called user_options or
> user_options.py?  I tried it both ways and got the same result.)


It doesn't matter what you name the file or whether it has a .py
extension. This is only significant for withlist scripts.

The problem is your Python version. optparse.OptionParser didn't have an
'epilog' attribute in Python 2.4. That requires Python 2.5.

If you just remove the lines 36 and 37:

epilog=Utils.wrap("""This script must be put in Mailman's bin/
directory."""),

from the script, it should work with Python 2.4, although the -h/--help
output won't contain that line.

Sorry about that. This dependency doesn't appear to be documented at
.
I'll add some comment to the script.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@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/archive%40jab.org


Re: [Mailman-Users] View a user's subscription options

2015-12-03 Thread Larry Kuenning

On 12/2/2015 2:59 PM, Mark Sapiro wrote:
> Based on a reply from Gretchen, I have implemented a first cut at this.
> The script can be found at
>  (mirrored at
> ). The script
> displays essentially all the user information on the user's options page
> including optionally the password.
>
> To use it, download it to Mailman's bin/ directory, make sure it has
> execute permission and then run 'bin/user_options -h' for more info.
>

I tried this and got:

[root@xxx mailman]# bin/user_options -h
Traceback (most recent call last):
  File "bin/user_options", line 98, in ?
main()
  File "bin/user_options", line 52, in main
ns, args = parseargs()
  File "bin/user_options", line 38, in parseargs
formatter=optparse.IndentedHelpFormatter())
TypeError: __init__() got an unexpected keyword argument 'epilog'

This is under Python 2.4.3.  (Should the file be called user_options or 
user_options.py?  I tried it both ways and got the same result.)


--
Larry Kuenning
la...@qhpress.org

--
Mailman-Users mailing list Mailman-Users@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/archive%40jab.org


Re: [Mailman-Users] View a user's subscription options

2015-12-02 Thread Mark Sapiro
On 12/01/2015 05:23 PM, Mark Sapiro wrote:
> On 12/01/2015 08:51 AM, Gretchen R Beck wrote:
>> Is there a command line script that can be used to view an individual user's 
>> subscription options for a specific list?
> 
> 
> I'm not aware of one, but it is fairly simple to do. I'm willing to add
> it to the collection at , but what do
> you want in the way of output. Presumably the input would be something like
> 
> get_user_options listname u...@example.com
> 
> but what kind of output are you looking for? What fields and in what format?


Based on a reply from Gretchen, I have implemented a first cut at this.
The script can be found at
 (mirrored at
). The script
displays essentially all the user information on the user's options page
including optionally the password.

To use it, download it to Mailman's bin/ directory, make sure it has
execute permission and then run 'bin/user_options -h' for more info.

Comments welcome.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@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/archive%40jab.org


Re: [Mailman-Users] View a user's subscription options

2015-12-01 Thread Mark Sapiro
On 12/01/2015 08:51 AM, Gretchen R Beck wrote:
> Is there a command line script that can be used to view an individual user's 
> subscription options for a specific list?


I'm not aware of one, but it is fairly simple to do. I'm willing to add
it to the collection at , but what do
you want in the way of output. Presumably the input would be something like

get_user_options listname u...@example.com

but what kind of output are you looking for? What fields and in what format?

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@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/archive%40jab.org