Thanks for posting this code Chris! It does work but I've run into a
minor quirk.
I am using genshi templates and the error page includes a master
template within which a few variable references are declared.
If the expected parameters are not passed in you won't see the usual
genshi error; the error page will simply not display and the default
cherrpy Traceback will display instead.
On Feb 8, 4:33 am, Christopher Arndt <[EMAIL PROTECTED]> wrote:
> gmane.comp.web.turbogearsvandevel schrieb:
>
> > Thanks for the response. I did notice that line of code and actually
> > removed the condition just to see if the method would be called but no
> > luck with that.
>
> Just tested the example code on the page with TG 1.0.4.3 and it seems
> that the relative name for the Kid templates for the error page does not
> work anymore. I have no idea why, it used to work with earlier versions
> of TG/Kid.
>
> Two possible workarounds:
>
> 1) Change the lines in the class ErrorCatcher
>
> _error_templates = {
> None: '.templates.unhandled_exception',
> 404: '.templates.404_exception',
> }
>
> to
> _error_templates = {
> None: '<myproject>.templates.unhandled_exception',
> 404: '<myproject>.templates.404_exception',
> }
>
> and substitute '<myproject>' with your actual project name.
>
> 2) At the top import turbogears.util, i.e. replace
>
> from turbogears import config, controllers, identity
>
> with
>
> from turbogears import config, controllers, identity, util
>
> and in the send_error_page method change the definition of 'body' to
>
> template = self._error_templates.get(status,
> self._error_templates.get(None))
> template = util.get_package_name() + template
> body = controllers._process_output(
> data,
> template,
> self.output_format,
> self.content_type,
> None
> )
>
> This means that the error templates are always searched within you app's
> package.
>
> I have pasted an updated and somewhat enhanced version of ErrorCatcher here:
>
> http://paste.turbogears.org/paste/1959
>
> And here's a matching template:
>
> http://paste.turbogears.org/paste/1960
>
> And a bare-bones controller to test it:
>
> http://paste.turbogears.org/paste/1961
>
> Don't forget to configure email settings in prod.cfg:
>
> # Error handling
> error_catcher.sender_email = '[EMAIL PROTECTED]'
> error_catcher.admin_email = '[EMAIL PROTECTED]'
> error_catcher.smtp_host = 'smtp.foo.com'
>
> If you are still stuck, please post code and error output (browser and
> console).
>
> 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
-~----------~----~----~----~------~----~------~--~---