|
Home > Archive > Apache Mod-Python > September 2006 > Proposal for adding html formatted tracebacks
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Proposal for adding html formatted tracebacks
|
|
| Dan Eloff 2006-08-27, 7:12 pm |
| I've been using html formatted tracebacks in my handlers for a little
while, and it's working rather well. Here's my proposal to add it to
mod_python. Once we've reached agreement I'll add it and attach the
files.
-Add a file exception.html to mod_python directory, it is the
standalone html page used for displaying tracebacks. It is loaded once
as a string.Template instance and cached. The template has one
variable, $traceback, which is substituted with the normal mod_python
traceback.
-The logic for formatting the traceback resides in exception.html as
javascript and can be fully customized. If it encounters an error
during formatting or if javascript is disabled, the traceback will be
visible as normal with no formatting.
-Uses markup and css to highlight important information in the
traceback. This can be customized by editing the styles in
exception.html. If you wish, by editing the javascript in
exception.html, you can have complete control over how the traceback
is formatted.
-Supports filters easily defined in the javascript that can hide or
show traces conditionally. By default a filter is enabled that hides
mod_python traces. When hidden, traces shrink down to 2px high colored
stripes. By clicking on the appropriate toggle link at the top of the
traceback you can toggle the filter to show or hide the matching
traces.
-One new option is added at the outermost scope of httpd.conf, defaulting as:
PythonOption mod_python.html_traceback On
Which if set to Off, will result in the usual tracebacks you get in mod_python.
Screenshot of demo attached.
-Dan
| |
| Graham Dumpleton 2006-08-27, 7:12 pm |
| Dan Eloff wrote ..
> I've been using html formatted tracebacks in my handlers for a little
> while, and it's working rather well. Here's my proposal to add it to
> mod_python. Once we've reached agreement I'll add it and attach the
> files.
>
> -Add a file exception.html to mod_python directory, it is the
> standalone html page used for displaying tracebacks. It is loaded once
> as a string.Template instance and cached. The template has one
> variable, $traceback, which is substituted with the normal mod_python
> traceback.
>
> -The logic for formatting the traceback resides in exception.html as
> javascript and can be fully customized. If it encounters an error
> during formatting or if javascript is disabled, the traceback will be
> visible as normal with no formatting.
>
> -Uses markup and css to highlight important information in the
> traceback. This can be customized by editing the styles in
> exception.html. If you wish, by editing the javascript in
> exception.html, you can have complete control over how the traceback
> is formatted.
>
> -Supports filters easily defined in the javascript that can hide or
> show traces conditionally. By default a filter is enabled that hides
> mod_python traces. When hidden, traces shrink down to 2px high colored
> stripes. By clicking on the appropriate toggle link at the top of the
> traceback you can toggle the filter to show or hide the matching
> traces.
>
> -One new option is added at the outermost scope of httpd.conf, defaulting
> as:
> PythonOption mod_python.html_traceback On
>
> Which if set to Off, will result in the usual tracebacks you get in mod_python.
>
> Screenshot of demo attached.
Hmmm, I didn't think you were wanting to go to that level of customisation.
If you do, I would suggest that we add a new directive to mod_python called
something like PythonExceptionHandler. The idea being that details of any
exception be supplied to your user supplied handler and everything is left up
to you as to how you render the page. I suggest this as I'm not real keen on
an approach whereby it depends on you having a special exception.html file
somewhere as that approach may not work in a lot of situations. By using a
handler, you can still use the approach you suggest, but that is up to you
and it wouldn't be dictating a specific way of doing things on people
that may not work for everyone.
Graham
| |
| Dan Eloff 2006-08-27, 7:12 pm |
| On 8/27/06, Graham Dumpleton <grahamd@dscpl.com.au> wrote:
> Hmmm, I didn't think you were wanting to go to that level of customisation.
I've only mocked up the idea, it would probably be between 5-8 hours
work to finish it as described.
> If you do, I would suggest that we add a new directive to mod_python called
> something like PythonExceptionHandler. The idea being that details of any
> exception be supplied to your user supplied handler and everything is left up
> to you as to how you render the page. I suggest this as I'm not real keen on
> an approach whereby it depends on you having a special exception.html file
> somewhere as that approach may not work in a lot of situations. By using a
> handler, you can still use the approach you suggest, but that is up to you
> and it wouldn't be dictating a specific way of doing things on people
> that may not work for everyone.
>
That is an excellent idea. I should have thought of it, except as
usual I get in a rut of trying to solve a problem one way without
first stopping and looking at the other solutions. However, it means
you will have to go to a lot of trouble to get something like I
described above, which while not working for everyone, would be nice
for most people. So how about a compromise. Use the
PythonExceptionHandler but make the handler I described as an example
in the docs, with a link to download exception.html. I'll strike a
balance between using Python and javascript so as to save myself some
effort, people can modify either at their discretion that way. That
way anyone can easily use that as a base (or as-is) for their handler
if they like.
Then more people than just myself will be able to benefit from my
work, which is rather overkill for just me 
What do you think?
-Dan
| |
| David Fraser 2006-08-28, 7:13 am |
| Graham Dumpleton wrote:
> Dan Eloff wrote ..
>
>
> Hmmm, I didn't think you were wanting to go to that level of customisation.
> If you do, I would suggest that we add a new directive to mod_python called
> something like PythonExceptionHandler. The idea being that details of any
> exception be supplied to your user supplied handler and everything is left up
> to you as to how you render the page. I suggest this as I'm not real keen on
> an approach whereby it depends on you having a special exception.html file
> somewhere as that approach may not work in a lot of situations. By using a
> handler, you can still use the approach you suggest, but that is up to you
> and it wouldn't be dictating a specific way of doing things on people
> that may not work for everyone.
If there is a default exception handler, it wuold be nice to be able to
set the HTML file used as a template using a PythonOption as well...
David
| |
| Graham Dumpleton 2006-09-02, 7:13 pm |
|
On 28/08/2006, at 8:40 AM, Dan Eloff wrote:
> On 8/27/06, Graham Dumpleton <grahamd@dscpl.com.au> wrote:
>
> I've only mocked up the idea, it would probably be between 5-8 hours
> work to finish it as described.
>
>
> That is an excellent idea. I should have thought of it, except as
> usual I get in a rut of trying to solve a problem one way without
> first stopping and looking at the other solutions. However, it means
> you will have to go to a lot of trouble to get something like I
> described above, which while not working for everyone, would be nice
> for most people. So how about a compromise. Use the
> PythonExceptionHandler but make the handler I described as an example
> in the docs, with a link to download exception.html. I'll strike a
> balance between using Python and javascript so as to save myself some
> effort, people can modify either at their discretion that way. That
> way anyone can easily use that as a base (or as-is) for their handler
> if they like.
Another thing that may be looked at in relation to this area is the
Apache API
for registering custom response handlers for error response codes.
http://www.kuzbass.ru/docs/apache_c_mod_perl/142.htm
It may be of use to be able to register such handlers from within a
mod_python
handler rather than relying on ErrorDocument directive.
Graham
| |
| Dan Eloff 2006-09-03, 1:12 pm |
| On 9/2/06, Graham Dumpleton <grahamd@dscpl.com.au> wrote:
> registering custom response handlers for error response codes.
>
> http://www.kuzbass.ru/docs/apache_c_mod_perl/142.htm
>
> It may be of use to be able to register such handlers from within a
> mod_python
> handler rather than relying on ErrorDocument directive.
>
It could certainly be done. I don't know who would have a use for such
a thing, but that's the beauty of mod_python is that you can do so
much with it. If someone wants to add it, I don't see why not.
-Dan
|
|
|
|
|