Nils Vogels <[EMAIL PROTECTED]> writes:
> Thanks Tim, that solves one problem, but unfortunately introduces
> another :-(
>
>
> For some reason my tmda-cgi now crashes nicely with the following message:
>
>
> *KeyError* Python 2.3.2: /usr/local/bin/python
[...]
> *KeyError*: 'RECIPIENT'
> args = ('RECIPIENT',)
Ugh. Try this instead; it's nearly the same, but the attempt to read
$RECIPIENT is moved inside the 'try' and the KeyError is trapped and
ignored just like the ValueError. I wasn't thinking about the config
file being read by programs other than tmda-filter. That's what you
get for an off-the-top-of-the-head fix! <hangs head in shame>
try:
rcptaddr = os.environ['RECIPIENT']
i = rcptaddr.rindex('@')
rcpt, host = rcptaddr[:i], rcptaddr[i+1:]
domain = '.'.join(host.split('.')[-2:])
os.environ['RECIPIENT'] = rcpt + '@' + domain
except KeyError, ValueError:
pass
Tim
_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users