hide lists from listinfo page only (leave on admin page)
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
We have migrated all mailing lists from Majordomo to Mailman (mailman-2.1.5-25.rhel3n on redhat 3.0 AS). We would like to hide those lists that are closed for subscription from the listinfo page for 2 reasons: to keep the page short and to avoid subscription attempts. We would like to keep them on the admin page for the list owners. Setting "advertised = 1" will hide the list from both listinfo page and admin page.
We would like to set this up at the list level so we dont have to modify the global configurations during upgrades. I have tried to modify web_page_url = listinfo/%(list_name)s to something like web_page_url = listinfo/%( )s to blank out the listinfo url but could not get the syntax right.
Am I on the right track? What are the other options?
Thanks.
Xiaoyan
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 5:44 PM -0700 2005-09-19, Xiaoyan Ma wrote:
Mailman doesn't work that way. Either a list is advertised (and
therefore shown in both places), or it's not (and you have to know or be able to guess the URL before you can go there).
If you want to supply some patches, upload them at
<http://sourceforge.net/tracker/?group_id=103&atid=300103> and we'll see when we may be able to include them in a future release. Otherwise, file a Request for Enhancement at <http://sourceforge.net/tracker/?group_id=103&atid=350103>, and hope that someone may be able to address this issue at some point in the hopefully not-too-distant future.
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Brad: Thank you for your advice. Sorry it took me so long get back on this.
I have submitted the new feature request as you suggested. As for applying patches, I don't know how it will affect upgrades. Do you normally need to un-patch before upgrade and then re-apply patches?
I would like to learn from other people on the list about how to organize large number of lists. With Majorcool, you can search from the drop down menu or search by key word. You can also tell if a list is open for subscription. Mailman's listinfo/admin page simply displays all lists from a-z (unless they are hidden). When there are hundreds of lists, it is not easy to find the list you for are looking for and once you find it you can not tell if you can subscribe to it.
Any suggestions will be appreciated. Thanks.
Xiaoyan
On Tue, 20 Sep 2005 08:15:18 +0200 Brad Knowles <brad@stop.mail-abuse.org> wrote:
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 10:16 PM -0700 2005-10-04, Xiaoyan Ma wrote:
I have submitted the new feature request as you suggested. As for applying patches, I don't know how it will affect upgrades.
That could be a problem, yes.
Do you
normally need to un-patch before upgrade and then re-apply patches?
I don't normally try to do that, no. But then, I don't normally
need to apply patches to my Mailman installations, either.
I would like to learn from other people on the list about how to organize large number of lists.
There are some postings from people who maintain the lists for
freebsd.org or lists.apple.com that you will find in the archives, some of which are also linked from the Mailman FAQ Wizard -- search for "performance", and you should see all the ones that are linked.
There's definitely a lot of wisdom encapsulated in these various
posts. I would encourage you to read all these FAQ entries and messages, and then ask any further questions you may have.
This is an area of the Mailman user interface that could use
improvement, yes. For the moment, try using the "find" feature within your browser.
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Are there documentations on how the Mailman package is organized? I am learning Python and would like to understand how the Mailman package, modules are organized. I found docs on how to use Mailman as a site admin, list owner/subscriber, but have not found any docs on the package itself. Thanks. Xiaoyan
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 10:46 PM -0700 2005-10-05, Xiaoyan Ma wrote:
It sounds like you've found all the documentation that exists.
As for the rest, well Python is supposed to be largely self-documenting....
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 11:04 AM -0700 2005-10-06, Xiaoyan Ma wrote:
Well, in case I have questions, (I am sure I will), is this the right list to post?
If you want to talk about Mailman operations, yes. If you want
to talk about development with respect to Mailman, you want the mailman-developers mailing list.
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/334b870d5b26878a79b2dc4cfcc500bc.jpg?s=120&d=mm&r=g)
"Brad" == Brad Knowles <brad@stop.mail-abuse.org> writes:
Brad> At 10:46 PM -0700 2005-10-05, Xiaoyan Ma wrote:
>> Are there documentations on how the Mailman package is
>> organized? I am learning Python and would like to understand
>> how the Mailman package, modules are organized. I found docs
>> on how to use Mailman as a site admin, list owner/subscriber,
>> but have not found any docs on the package itself.
Brad> It sounds like you've found all the documentation that
Brad> exists. As for the rest, well Python is supposed to be
Brad> largely self-documenting....
If you've got a capable workstation, then
cd /path/to/mailman pydoc -p 4242
and open http://localhost:4242/ in your favorite browser is likely to be very helpful. I haven't tried it yet on Mailman, but it has been very effective on some of my own small projects. You may need to descend into subdirectories before starting pydoc. pydoc -g might work the same way, but with a built-in browser. I haven't tried that either, I like my Firefox.
-- School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Each semester we create a few hundreds course mailing lists, prepopulate them, and delete them by the end of the semester. If we want to hide these lists from the listinfo page only, can I modify the listinfo.py file, store the name of these lists in an arrey say called "notshowns" and then add a logic right after "listnames.sort()", for name in listnames but not in notshowns ....
..... for name in listnames:(but not in notshowns) mlist = MailList.MailList(name, lock=0) if mlist.advertised: if mm_cfg.VIRTUAL_HOST_OVERVIEW mlist.web_page_url.find(hostname) == -1: # List is for different identity of this host - skip it. continue else: advertised.append((mlist.GetScriptURL('listinfo'), mlist.real_name, mlist.description)) ...
- Is it safe to modify the logic of this file?
- What will happen during upgrades?
BTW, there is a ../mailman/cgi-bin/listinfo file:
.../mailman/cgi-bin/listinfo: setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
The size of this file seems to stay the same after the listinfo.py has been modified. How is this file related to listinfo.py file?
Thanks. Xiaoyan
On Wed, 5 Oct 2005 20:11:33 +0200 Brad Knowles <brad@stop.mail-abuse.org> wrote:
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Xiaoyan Ma wrote:
Presumably this is pseudocode. It's not Python. Python might be
for name in listnames: if name in notshowns: continue
Yes (as long as you don't make a mistake :-), but see 2.
The upgrade listinfo.py will replace the one with your changes. You will have to remake your changes in the new file.
This and all the files in cgi-bin/ are the security wrappers which are invoked directly by the web server. They perform a few checks and then call the corresponding Python module in Mailman/Cgi via the scripts/driver script. The source for these files is in src/cgi-wrapper.c and src/common.[ch]
There may be other ways to do this that don't require maintenance of a separate list. E.g., you could modify admin.py to display all lists regardless of the setting of advertised. Then lists with advertised set to No would be displayed on the admin overview but not the listinfo overview.
Also, what is the goal? If it is simply to avoid 'clutter' on the listinfo overview but still allow 'one click' access to the admin page, then you may be on the right track, but if you are trying to actually 'hide' the existence or name of the lists, anyone can go to the admin overview page and see them.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
On Fri, 7 Oct 2005 10:12:48 -0700 Mark Sapiro <msapiro@value.net> wrote:
..... for name in listnames:(but not in notshowns)
Thank you. I just started learning python, so I wanted to find out if I am on the right track first. I have spent 2 hours on these few lines of code, but have not got it to work yet. I tried to run the listinfo.py file alone to debug and got the following message (either running the original file that came with the package or what I have modified):
python /var/mailman/Mailman/Cgi/listinfo.py Traceback (most recent call last): File "/var/mailman/Mailman/Cgi/listinfo.py", line 25, in ? from Mailman import mm_cfg ImportError: No module named Mailman
What did I miss?
This is a great idea, I will test it out as well.
Tha goal is to avoid clutter and subscription attempts. I think modify the admin.py file as you suggested might be a better option. Maybe require authentication to access the admin page.
Thanks a lot.
Xiaoyan
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Xiaoyan Ma wrote:
By default, Python will only access modules in the Python libraries and the directory that contains the current module. Modules in the bin/ directory for example get around this by importing 'paths' which is the bin/paths.py file which sets some additional directories in the search paths.
The easiest way to make this work for testing purposes is just to store your test file in the $prefix directory, i.e. the directory that contains the Mailman/, bin/, etc. directories.
A key thing in Python code is indentation because that's how Python determines block structure. It is critical that things be indented consistently and that either tabs or spaces but not a mixture be used for indentation. The above snippet, properly indented looks like
for name in listnames: if name in notshowns: continue mlist = MailList.MailList(name, lock=0) if mlist.advertised:
It is critical that "if name in notshowns:" is indented exactly the same amount as "mlist = MailList.MailList(name, lock=0)" and that other indentation be preserved exactly as in the original.
Tha goal is to avoid clutter and subscription attempts. I think modify the admin.py file as you suggested might be a better option. Maybe require authentication to access the admin page.
Presumably you will have the lists' subscribe_policy set to 'Require approval'. I am only guessing, but I think that not showing the lists on the listinfo page would reduce the spurious subscription attempts to a level where manually rejecting them would not be too burdensome. I would guess there would certainly be no more subscription requests than non-member posts.
What I'm saying here is that authenticating access to the admin overview page could be tricky (what password(s) would be used?) and may not be worth the trouble.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Thank you so much for your help. I got it to work!
I found out that I made two errors by testing the script from $PREFIX directory as you suggested. One was indentation. The other was the failure to clean up all the newlines when I extracted listnames that I wanted to hide from a file (one listname per line).
Here is what I have now: myfile = '/var/mailman/Mailman/Cgi/notshown' noshowns = string.split(open(myfile).read()) noshowns.sort()
for name in listnames:
if name in noshowns:
continue
mlist = MailList.MailList(name, lock=0)
if mlist.advertised:
if mm_cfg.VIRTUAL_HOST_OVERVIEW and \
mlist.web_page_url.find(hostname) == -1:
# List is for different identity of this host - skip it.
continue
else:
advertised.append((mlist.GetScriptURL('listinfo'),
mlist.real_name,
mlist.description))
Since I need to store a few hundreds listnames in the file, I wonder if it might be better to use regular expressions. Five to six regular expressions should be sufficient to match all the list names I want to hide.
Another option (if it is doable) is to use Mailman's supported advertise feature to hide these lists from both listinfo and admin page. I will subsequently bring up a third page, either a "sub-admin" page showing only those hidden course lists, or a "supper admin" page displaying all lists. The goal is that future upgrades won't entail re-customizing the previously customized package files. But I am afraid this may turn out to be so complicated as to involve security wrapper and other matters.
I would be very grateful to have your feed back.
Thanks. Xiaoyan
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Xiaoyan Ma wrote:
Between the two, I'd say whatever is easier for you to maintain is best
- maybe the regexps if they are constant.
I think this may be the best way. It is non-trivial but doable. You need to make the appropriate mods to the Mailman/Cgi/admin.py script and store the modified script as, say, Mailman/Cgi/sub-admin.py. Then you also need to make another wrapper, sub-admin, in the cgi-bin/ directory. See src/Makefile (created by ./configure) or src/Makefile.in in the distribution hierarchy for info on compiling the wrappers.
Once you've created the script and the wrapper, you will be OK in an upgrade as long as you don't change any options to ./configure. If things are moved or --with-cgi-gid= changes, you'll have to rebuild the sub-admin wrapper.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 5:44 PM -0700 2005-09-19, Xiaoyan Ma wrote:
Mailman doesn't work that way. Either a list is advertised (and
therefore shown in both places), or it's not (and you have to know or be able to guess the URL before you can go there).
If you want to supply some patches, upload them at
<http://sourceforge.net/tracker/?group_id=103&atid=300103> and we'll see when we may be able to include them in a future release. Otherwise, file a Request for Enhancement at <http://sourceforge.net/tracker/?group_id=103&atid=350103>, and hope that someone may be able to address this issue at some point in the hopefully not-too-distant future.
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Brad: Thank you for your advice. Sorry it took me so long get back on this.
I have submitted the new feature request as you suggested. As for applying patches, I don't know how it will affect upgrades. Do you normally need to un-patch before upgrade and then re-apply patches?
I would like to learn from other people on the list about how to organize large number of lists. With Majorcool, you can search from the drop down menu or search by key word. You can also tell if a list is open for subscription. Mailman's listinfo/admin page simply displays all lists from a-z (unless they are hidden). When there are hundreds of lists, it is not easy to find the list you for are looking for and once you find it you can not tell if you can subscribe to it.
Any suggestions will be appreciated. Thanks.
Xiaoyan
On Tue, 20 Sep 2005 08:15:18 +0200 Brad Knowles <brad@stop.mail-abuse.org> wrote:
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 10:16 PM -0700 2005-10-04, Xiaoyan Ma wrote:
I have submitted the new feature request as you suggested. As for applying patches, I don't know how it will affect upgrades.
That could be a problem, yes.
Do you
normally need to un-patch before upgrade and then re-apply patches?
I don't normally try to do that, no. But then, I don't normally
need to apply patches to my Mailman installations, either.
I would like to learn from other people on the list about how to organize large number of lists.
There are some postings from people who maintain the lists for
freebsd.org or lists.apple.com that you will find in the archives, some of which are also linked from the Mailman FAQ Wizard -- search for "performance", and you should see all the ones that are linked.
There's definitely a lot of wisdom encapsulated in these various
posts. I would encourage you to read all these FAQ entries and messages, and then ask any further questions you may have.
This is an area of the Mailman user interface that could use
improvement, yes. For the moment, try using the "find" feature within your browser.
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Are there documentations on how the Mailman package is organized? I am learning Python and would like to understand how the Mailman package, modules are organized. I found docs on how to use Mailman as a site admin, list owner/subscriber, but have not found any docs on the package itself. Thanks. Xiaoyan
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 10:46 PM -0700 2005-10-05, Xiaoyan Ma wrote:
It sounds like you've found all the documentation that exists.
As for the rest, well Python is supposed to be largely self-documenting....
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/e6ea3e5ffc3558c74e9f8cbf3f38357a.jpg?s=120&d=mm&r=g)
At 11:04 AM -0700 2005-10-06, Xiaoyan Ma wrote:
Well, in case I have questions, (I am sure I will), is this the right list to post?
If you want to talk about Mailman operations, yes. If you want
to talk about development with respect to Mailman, you want the mailman-developers mailing list.
-- Brad Knowles, <brad@stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
![](https://secure.gravatar.com/avatar/334b870d5b26878a79b2dc4cfcc500bc.jpg?s=120&d=mm&r=g)
"Brad" == Brad Knowles <brad@stop.mail-abuse.org> writes:
Brad> At 10:46 PM -0700 2005-10-05, Xiaoyan Ma wrote:
>> Are there documentations on how the Mailman package is
>> organized? I am learning Python and would like to understand
>> how the Mailman package, modules are organized. I found docs
>> on how to use Mailman as a site admin, list owner/subscriber,
>> but have not found any docs on the package itself.
Brad> It sounds like you've found all the documentation that
Brad> exists. As for the rest, well Python is supposed to be
Brad> largely self-documenting....
If you've got a capable workstation, then
cd /path/to/mailman pydoc -p 4242
and open http://localhost:4242/ in your favorite browser is likely to be very helpful. I haven't tried it yet on Mailman, but it has been very effective on some of my own small projects. You may need to descend into subdirectories before starting pydoc. pydoc -g might work the same way, but with a built-in browser. I haven't tried that either, I like my Firefox.
-- School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Each semester we create a few hundreds course mailing lists, prepopulate them, and delete them by the end of the semester. If we want to hide these lists from the listinfo page only, can I modify the listinfo.py file, store the name of these lists in an arrey say called "notshowns" and then add a logic right after "listnames.sort()", for name in listnames but not in notshowns ....
..... for name in listnames:(but not in notshowns) mlist = MailList.MailList(name, lock=0) if mlist.advertised: if mm_cfg.VIRTUAL_HOST_OVERVIEW mlist.web_page_url.find(hostname) == -1: # List is for different identity of this host - skip it. continue else: advertised.append((mlist.GetScriptURL('listinfo'), mlist.real_name, mlist.description)) ...
- Is it safe to modify the logic of this file?
- What will happen during upgrades?
BTW, there is a ../mailman/cgi-bin/listinfo file:
.../mailman/cgi-bin/listinfo: setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
The size of this file seems to stay the same after the listinfo.py has been modified. How is this file related to listinfo.py file?
Thanks. Xiaoyan
On Wed, 5 Oct 2005 20:11:33 +0200 Brad Knowles <brad@stop.mail-abuse.org> wrote:
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Xiaoyan Ma wrote:
Presumably this is pseudocode. It's not Python. Python might be
for name in listnames: if name in notshowns: continue
Yes (as long as you don't make a mistake :-), but see 2.
The upgrade listinfo.py will replace the one with your changes. You will have to remake your changes in the new file.
This and all the files in cgi-bin/ are the security wrappers which are invoked directly by the web server. They perform a few checks and then call the corresponding Python module in Mailman/Cgi via the scripts/driver script. The source for these files is in src/cgi-wrapper.c and src/common.[ch]
There may be other ways to do this that don't require maintenance of a separate list. E.g., you could modify admin.py to display all lists regardless of the setting of advertised. Then lists with advertised set to No would be displayed on the admin overview but not the listinfo overview.
Also, what is the goal? If it is simply to avoid 'clutter' on the listinfo overview but still allow 'one click' access to the admin page, then you may be on the right track, but if you are trying to actually 'hide' the existence or name of the lists, anyone can go to the admin overview page and see them.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
On Fri, 7 Oct 2005 10:12:48 -0700 Mark Sapiro <msapiro@value.net> wrote:
..... for name in listnames:(but not in notshowns)
Thank you. I just started learning python, so I wanted to find out if I am on the right track first. I have spent 2 hours on these few lines of code, but have not got it to work yet. I tried to run the listinfo.py file alone to debug and got the following message (either running the original file that came with the package or what I have modified):
python /var/mailman/Mailman/Cgi/listinfo.py Traceback (most recent call last): File "/var/mailman/Mailman/Cgi/listinfo.py", line 25, in ? from Mailman import mm_cfg ImportError: No module named Mailman
What did I miss?
This is a great idea, I will test it out as well.
Tha goal is to avoid clutter and subscription attempts. I think modify the admin.py file as you suggested might be a better option. Maybe require authentication to access the admin page.
Thanks a lot.
Xiaoyan
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Xiaoyan Ma wrote:
By default, Python will only access modules in the Python libraries and the directory that contains the current module. Modules in the bin/ directory for example get around this by importing 'paths' which is the bin/paths.py file which sets some additional directories in the search paths.
The easiest way to make this work for testing purposes is just to store your test file in the $prefix directory, i.e. the directory that contains the Mailman/, bin/, etc. directories.
A key thing in Python code is indentation because that's how Python determines block structure. It is critical that things be indented consistently and that either tabs or spaces but not a mixture be used for indentation. The above snippet, properly indented looks like
for name in listnames: if name in notshowns: continue mlist = MailList.MailList(name, lock=0) if mlist.advertised:
It is critical that "if name in notshowns:" is indented exactly the same amount as "mlist = MailList.MailList(name, lock=0)" and that other indentation be preserved exactly as in the original.
Tha goal is to avoid clutter and subscription attempts. I think modify the admin.py file as you suggested might be a better option. Maybe require authentication to access the admin page.
Presumably you will have the lists' subscribe_policy set to 'Require approval'. I am only guessing, but I think that not showing the lists on the listinfo page would reduce the spurious subscription attempts to a level where manually rejecting them would not be too burdensome. I would guess there would certainly be no more subscription requests than non-member posts.
What I'm saying here is that authenticating access to the admin overview page could be tricky (what password(s) would be used?) and may not be worth the trouble.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
![](https://secure.gravatar.com/avatar/b9d202318dc31f37ae474f872ddc40a2.jpg?s=120&d=mm&r=g)
Thank you so much for your help. I got it to work!
I found out that I made two errors by testing the script from $PREFIX directory as you suggested. One was indentation. The other was the failure to clean up all the newlines when I extracted listnames that I wanted to hide from a file (one listname per line).
Here is what I have now: myfile = '/var/mailman/Mailman/Cgi/notshown' noshowns = string.split(open(myfile).read()) noshowns.sort()
for name in listnames:
if name in noshowns:
continue
mlist = MailList.MailList(name, lock=0)
if mlist.advertised:
if mm_cfg.VIRTUAL_HOST_OVERVIEW and \
mlist.web_page_url.find(hostname) == -1:
# List is for different identity of this host - skip it.
continue
else:
advertised.append((mlist.GetScriptURL('listinfo'),
mlist.real_name,
mlist.description))
Since I need to store a few hundreds listnames in the file, I wonder if it might be better to use regular expressions. Five to six regular expressions should be sufficient to match all the list names I want to hide.
Another option (if it is doable) is to use Mailman's supported advertise feature to hide these lists from both listinfo and admin page. I will subsequently bring up a third page, either a "sub-admin" page showing only those hidden course lists, or a "supper admin" page displaying all lists. The goal is that future upgrades won't entail re-customizing the previously customized package files. But I am afraid this may turn out to be so complicated as to involve security wrapper and other matters.
I would be very grateful to have your feed back.
Thanks. Xiaoyan
![](https://secure.gravatar.com/avatar/746f7519ba02fb0d815e59f305c53fa2.jpg?s=120&d=mm&r=g)
Xiaoyan Ma wrote:
Between the two, I'd say whatever is easier for you to maintain is best
- maybe the regexps if they are constant.
I think this may be the best way. It is non-trivial but doable. You need to make the appropriate mods to the Mailman/Cgi/admin.py script and store the modified script as, say, Mailman/Cgi/sub-admin.py. Then you also need to make another wrapper, sub-admin, in the cgi-bin/ directory. See src/Makefile (created by ./configure) or src/Makefile.in in the distribution hierarchy for info on compiling the wrappers.
Once you've created the script and the wrapper, you will be OK in an upgrade as long as you don't change any options to ./configure. If things are moved or --with-cgi-gid= changes, you'll have to rebuild the sub-admin wrapper.
-- Mark Sapiro <msapiro@value.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (4)
-
Brad Knowles
-
Mark Sapiro
-
Stephen J. Turnbull
-
Xiaoyan Ma