Steve schrieb:
> The third option worked, however I placed the code into my Root class
> instead of creating an ErrorCatcher Class.
Yes, that's perfectly viable, but I like to factor out distinctive
functionality in to its own class.
> The only thing that didn't work at first was this definition:
>
> def __init__(self, *args, **kw):
> super(ErrorCatcher, self).__init__(*args, **kw)
[...]
>
> I think because I needed to change super(ErrorCatcher, self) etc. to
> super(Root,self) etc.
Yes, that's the normal semantics of the super() function. The first argument
should be the class, from whose methid you are calling it.
> I don't think I want to email anything at this point, [...]
You could insert a check for another custom configuration setting, e.g.
'error_catcher.send_email' (True/False):
In method 'cp_on_http_error':
if config.get('error_catcher.send_email', True) and (status != 404
or config.get('error_catcher.send_email_on_404', False)):
try:
self.send_exception_email(status, url, details)
data['email_sent'] = True
except Exception, exc:
log.exception('Error email failed: %s', exc)
data['email_sent'] = False
else:
data['email_sent'] = False
I'll update the code on the wiki page with this as well.
Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---