Xiaoyan Ma wrote:
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?
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.
Presumably this is pseudocode. It's not Python. Python might be
for name in listnames: if name in notshowns: continue
mlist = MailList.MailList(name, lock=0) if mlist.advertised:<snip>
...
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