On Thu, Jun 27, 2002 at 11:03:56AM -0400, Sam Varshavchik wrote:

> >>>ext = os.environ['EXT'] 
> >>
> >>>  command = mlm + ' ctlmsg ' + string.split(ext,'-')[0] 
> >>
> >>So you pop off one off EXT.  
> >>
> >>>  command = mlm + ' msg ' + ext
> >>>print command 
> >>
> >>However when couriermlm runs, EXT still contains its original value, so 
> >>couriermlm reads EXT, and will not understand the command. 
> >
> >I don't understand. If I have a .courier-default or a
> >.courier-anand-default, EXT contains the string "anand-help" in both
> >cases, so I would expect that couriermlm, when run out of either file,
> 
> I meant DEFAULT. couriermlm reads DEFAULT to determine the control command. 
> 
> 'anand-help' is not a valid control command.  'help' is, but 'anand-help' 
> isn't. 

Thanks! I understand now. I changed my code to do DEFAULT=EXT2. I
also changed the code to open a pipe directly to couriermlm instead of
relying on dynamic delivery, and now it works. I now only have a single
.courier-default, containing "|./wrapper" and creating and deleting
lists has become easier :) If anyone's interested, find my finished
wrapper below:


#!/usr/bin/python

import os, sys, string

ext = os.environ['EXT']

mlm = '/usr/lib/courier/bin/couriermlm'
sendmail = '/usr/lib/courier/bin/sendmail'
owneraddress = '[EMAIL PROTECTED]'

if os.environ['EXT2'] == 'owner':
  # dispatch to list owner
  command = sendmail + ' -f "' + os.environ['SENDER'] + '" ' + owneraddress
elif '-' in ext:
  # dispatch to list controller
  command = mlm + ' ctlmsg ' + string.split(ext,'-')[0]
else:
  # address has no special actions, so likely a list
  # dispatch to list
  command = mlm + ' msg ' + ext

# DEFAULT contains listname-command. Change it to contain the command only

os.environ['DEFAULT']=os.environ['EXT2']

c=os.popen(command,'w')
c.write(sys.stdin.read())
sys.exit(c.close()/256)

-- 
Anand Buddhdev
http://anand.org


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to