>I wrote a working server handler now. Can I make pages which do not
>define a request-level handler use my custom server handler in some easy
>way? It currently uses the default 'Spyce Exception' display, I would
>prefer it used the same code as my custom server handler unless the
>request-level handler is overridden.
I'm going to reply to all of your six messages in this one, because they
seem related. I just checked the server-level error handler and it works
fine. Here is an example (and I will update the documentation):
--- spyce.conf --- (in the spyce directory)
--- myerror.py --- (somewhere in the spyce path)
def myHandler(server, request, response, theError):
response.write('my server-level error handler\n')
--- rim.spy --- (note the intentional syntax error)
[[ print 'hi'
Now, run 'spyce rim.spy', and you'll see:
> my server-level error handler
as expected. Remember that the server-level error handler is only called
before Spyce processing begins, for things that the regular error module
could never see. This includes Spyce and Python syntax errors. However,
once the Spyce processing begins, it's up to you to override the
page-level error handler, using error.setFileHandler(),
error.setStringHandler(), or the general-purpose error.setHandler().
If you would like to always use a custom error handler as your page
handler default, then I can add an option for this in the spyce.conf,
although it seems a little bit unnecessary. Right now, the error module
has a built-in default, a string in a variable called defaultErrorTemplate
(in modules/error.py). This could be changed to look for the default error
string (or function) using a configuration directive.
All the best,