terom@134: """ terom@134: Our custom WSGI application terom@134: """ terom@134: terom@134: from qmsk.web import wsgi terom@134: terom@134: import urls, error terom@134: terom@134: # our custom app with custom error() method terom@134: class Application (wsgi.Application) : terom@134: def __init__ (self) : terom@134: """ terom@134: Construct wsgi.Application with our URLMapper terom@134: """ terom@134: terom@134: super(Application, self).__init__(urls.mapper) terom@134: terom@134: def handle_error (self, exc_info, env, start_response) : terom@134: """ terom@134: Use error.build_error and return that terom@134: """ terom@134: terom@134: # get info terom@135: status, content_type, body = error.build_error(env=env) terom@134: terom@134: # headers terom@134: start_response(status, [('Content-type', content_type)], exc_info) terom@134: terom@134: # body terom@134: return body terom@134: