Mark,

Thanks for your suggestions. I tried running it using withlist as you 
suggested. My 
maxmessagesize.py is below:

###maxmessagesize.py
### determines maximum message size allowed to select lists
### useage: withlist -l -r maxmessagesize
def maxmessagesize(m):
#
# open and read the list names file
    f = open('/home/chris/lists.txt')
    l = f.read()
#
# is this list's name in the file
    if l.find(m._internal_name) >= 0:
       m.max_message_size = 500
       m.Save()
       m.Unlock()
    f.close()


The following is the result:


./withlist -l -a -r maxmessagesize
Importing maxmessagesize...
Traceback (most recent call last):
   File "./withlist", line 275, in ?
     main()
   File "./withlist", line 247, in main
     mod = __import__(module)
   File "./maxmessagesize.py", line 8
     l = f.read()
     ^
SyntaxError: invalid syntax


Can you give me some idea what may be wrong. I realize your suggestion was just 
off the top of your 
head. I also don't quite understand the need for the lines:

if l.find(m._internal_name) >= 0:
       m.max_message_size = 500

If I have already written out a file of  lists that I want to affect with 
withlist, it doesn't seem 
like I would need this.

Thanks for any suggestions that you can give me. I am a little slow at picking 
up Python.


Christopher Adams





Mark Sapiro wrote:
> Christopher Adams wrote:
> 
> 
>>I would like to change the max_message_size for a group of lists. I plan to 
>>use withlist to do this. 
>>I have the withlist command below and can do it with all lists or 1 list but 
>>am unsure how to do it 
>>with a group of lists, whose names are currently in a text file. I probably 
>>could do it using a 
>>shell script or something, but I am guessing that withlist probably accepts 
>>files for input, but how?
> 
> 
> 
> There is no option for withlist to directly process other than a single
> list or all lists. To run a script via withlist on a subset of lists
> contained in a file, you could use a shell script or modify your
> withlist script along the lines of the following (off the top of my
> head, really quick - no testing, no warranty)
> 
> 
> ###maxmessagesize.py
> ### determines maximum message size allowed to select lists
> ### useage: withlist -l -r maxmessagesize
> def maxmessagesize(m):
> #
> # open and read the list names file
>    f = open('path to your file of names')
>    l = f.read()
> #
> # is this list's name in the file
>    if l.find(m._internal_name) >= 0:
>       m.max_message_size = 500
>       m.Save()
>       m.Unlock()
>    f.close()
> 
> One potential problem is it will process a list you don't want whose
> name is a substring of the name of a list you do want.
> 
> --
> Mark Sapiro <[EMAIL PROTECTED]>       The highway is for gamblers,
> San Francisco Bay Area, California    better use your sense - B. Dylan
> 


------------------------------------------------------
Mailman-Users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

Reply via email to