[Zope] MailHost and Bcc
Chris Withers
chris at simplistix.co.uk
Fri Jul 13 08:44:57 EDT 2007
Catherine E. Reinehr wrote:
> try:
> mailhost=getattr(context, context.superValues('Mail Host')[0].id)
> except:
> raise AttributeError, "cant find a Mail Host object"
...passing comment, this is extremely bad code.
A bare try/except is bad.
Why catch the exception in the first place, just let it propogate.
> try:
> mailhost.send(printed, mTo, mFrom, mSubj)
> request.RESPONSE.redirect('/sbps/application_success')
>
> except:
> request.RESPONSE.redirect('/sbps/application_error')
Another bare except, also insanely bad...
You could do with looking at either MailTemplates or, better still,
Twiddler with a plain text input parser and email output renderer.
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope
mailing list