[Mailman-Developers] file permissions

Michael McLay mclay@nist.gov
Fri, 5 Jun 1998 13:31:06 -0400 (EDT)


Nothing like following up to your own posts:-)

Michael McLay writes:
 > In order to find the problem I did some 
 > code reorganization.  The $prefix/scripts/subscribe file was moved to
 > $prefix/Mailman/subscribe.py and the attached file was put in place of
 > the $prefix/scripts/subscribe file.
 > 
 > This change should also reduce the script execution time slightly
 > because the longer script will be compiled to a .pyc file.  I would
 > like to wrap all the other file in the $prefix/scripts/ in the same
 > manner. Once this is done the common.c program can be modified to
 > insert the PREFIX directory into the path rather than the MODULEDIR.

Why not have the install script install the package Mailman directly
in the user's site-python directory?  Isn't that where it belongs?
Then the path manipulation doesn't have to take place at all.

 > This will eliminate the need for the paths module in each of the
 > scripts and it would eliminate the need for the following lines in my
 > new wrapper script:
 > 
 >     sys.path.remove('/usr/local/mailman/Mailman')
 >     sys.path.insert(0, '/usr/local/mailman')
 > 
 > This generalized error wrapper would also eliminate some redundant
 > error reporting code in admin.

I've done a little more work on generalizing the wrapper and adding
some more optional debug information.  The new module Mailman.debug
contains two functions.  The first one prints out the trace
information.  The second function will print out uid and gid
information and the server environment variables.  I turn off the more 
detailed messages using a debug flag in the $prefix/script/* scripts.

If the Mailman is moved to site-python then the "import sys" statement 
could be deleted and the only statement inside the try block would be 

	from Mailman.subscribe import *

The SystemExit exception could be eliminated as well if the code in
Mailman.subscribe were rearranged to eliminate the call to
sys.exit().  

The new arrangement also moves the debug code out of the scripts
unless an exception is called.  This reduces $prefix/script/subscribe
file to the following:


########################## $prefix/script/subscribe #################
#! /usr/bin/env python
#
# Copyright (C) 1998 by the Free Software Foundation, Inc.
# under the GNU General Public License  See the License file in the top level
# of this distribution for details.

"""Process subscribe form submission, ie subscriptions or roster requests."""

debug = 1  # turn on to enable environment parameter printing on errors
import sys
try:
    sys.path.remove('/usr/local/mailman/Mailman')
    sys.path.insert(0, '/usr/local/mailman')
    from Mailman.subscribe import *

except SystemExit:
    pass

except:
    import Mailman.debug
    Mailman.debug.print_trace()
    if debug:
	Mailman.debug.print_environ()