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

« back to all changes in this revision

Viewing changes to ivle/dispatch/__init__.py

Merge from new-dispatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
from ivle.dispatch.request import Request
47
47
from ivle.dispatch import login
48
48
from ivle.webapp.base.plugins import ViewPlugin
49
 
from ivle.webapp.errors import HTTPError
 
49
from ivle.webapp.errors import HTTPError, Unauthorized
50
50
import apps
51
51
import html
52
52
 
64
64
    'ivle.webapp.security#Plugin',
65
65
    'ivle.webapp.media#Plugin',
66
66
    'ivle.webapp.forum#Plugin',
 
67
    'ivle.webapp.help#Plugin',
 
68
    'ivle.webapp.tos#Plugin',
67
69
68
70
 
69
71
def generate_route_mapper(view_plugins):
155
157
        try:
156
158
            # Instantiate the view, which should be a BaseView class
157
159
            view = viewcls(req, **kwargs)
 
160
 
 
161
            # Check that the request (mainly the user) is permitted to access
 
162
            # the view.
 
163
            if not view.authorize(req):
 
164
                raise Unauthorized()
158
165
            # Render the output
159
166
            view.render(req)
160
167
        except HTTPError, e: