qmsk/irclogs/wsgi.py
author Tero Marttila <terom@fixme.fi>
Sun, 13 Sep 2009 01:15:56 +0300
changeset 140 6db2527b67cf
parent 135 wsgi.py@19ff083c2870
permissions -rw-r--r--
restructure into package format - the qmsk.* stuff doesn't work so well though, requires a symlink for qmsk.web to work...
"""
    Our custom WSGI application
"""

from qmsk.web import wsgi

import urls, error

# our custom app with custom error() method
class Application (wsgi.Application) :
    def __init__ (self) :
        """
            Construct wsgi.Application with our URLMapper
        """

        super(Application, self).__init__(urls.mapper)
    
    def handle_error (self, exc_info, env, start_response) :
        """
            Use error.build_error and return that
        """
        
        # get info
        status, content_type, body = error.build_error(env=env)

        # headers
        start_response(status, [('Content-type', content_type)], exc_info)

        # body
        return body