-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
I'm trying to create a machinery to handle renderer exceptions.
Considere the following template:
<span nevow:render="main_page">
<span nevow:pattern="main_pattern"> ... </span>
<span nevow:pattern="safe_pattern"> <span nevow:render="handle_err">Oops, there was an exception</span> </span>
</span>
The idea is to define a base class so that, for each page based on such template, on renderer exceptions, the main pattern is deleted and the failsafe pattern is filled with a human readable error.
For example:
class basePage(rend.Page):
def render_main_page(self, ctx, d): try: render_the_main_pattern(...)
except Exception, err: self.strexception= str(err) render_the_safe_pattern(...)
def render_handle_err(self, ctx, d): if hasattr(self, 'strexception'): return self.strexception return 'UfoError'
class OtherPage(basePage): ...
It would be very nice to have such machinery: how can I choose to render the safe_pattern if and only if the main pattern rendering fails?
Otherwise, is there in your opinion a better strategy?
- -- efphe Today is Setting Orange, the 55th day of Chaos in the YOLD 3174