From: Stefan Schwarzer <stefan.schwarzer@tu...> - 2003-04-10 19:24:24
On Tue, 8 Apr 2003 soif@... wrote:
> I 'm looking for a way to do something like that :
> i use mod_webkit. I really understand how to do this but
> i don't know how to call 404 handler instead of the mod_webkit
Currently, I set up my 404 handler by putting the following in the
`__init__.py` of my WebKit context:
def contextInitialize(application, context_path):
application.handleBadURL = new_bad_url_handler
response = transaction.response()
response.setHeader('Status', '301 Redirect')
This may seem a little strange, but, after all, Python makes such
things possible. ;-) It's possible because the argument `application`
is an object, not a class, and thus I have to "inject" a bound method
(note the "missing" `self` in `new_bad_url_handler`).
See the topic "TransactionAnatomy" on the Webware Wiki for some notes
on the `handleBadURL` method.
Get latest updates about Open Source Projects, Conferences and News.