~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/dispatch/__init__.py

XHTMLErrorView is now the default error view, so we get nice 404s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
from ivle.dispatch.request import Request
45
45
import ivle.webapp.security
46
46
from ivle.webapp.base.plugins import ViewPlugin, PublicViewPlugin
47
 
from ivle.webapp.errors import HTTPError, Unauthorized
 
47
from ivle.webapp.base.xhtml import XHTMLView, XHTMLErrorView
 
48
from ivle.webapp.errors import HTTPError, Unauthorized, NotFound
48
49
 
49
50
def generate_route_mapper(view_plugins, attr):
50
51
    """
116
117
            if hasattr(viewcls, 'get_error_view'):
117
118
                errviewcls = viewcls.get_error_view(e)
118
119
            else:
119
 
                errviewcls = None
 
120
                errviewcls = XHTMLView.get_error_view(e)
120
121
 
121
122
            if errviewcls:
122
123
                errview = errviewcls(req, e)
135
136
            req.store.commit()
136
137
            return req.OK
137
138
    else:
138
 
        return req.HTTP_NOT_FOUND # TODO: Prettify.
 
139
        XHTMLErrorView(req, NotFound()).render(req)
 
140
        return req.OK
139
141
 
140
142
def handle_unknown_exception(req, exc_type, exc_value, exc_traceback):
141
143
    """