22
22
Apache send all requests to be handled by the module 'dispatch'.
24
24
Top-level handler. Handles all requests to all pages in IVLE.
25
Handles authentication (not authorization).
26
Then passes the request along to the appropriate ivle app.
25
Handles authentication and delegates to views for authorization,
26
then passes the request along to the appropriate view.
62
62
m.connect(routex, view=view_class, **kwargs_dict)
66
"""Handles a request which may be to anywhere in the site except media.
65
def handler(apachereq):
66
"""Handles an HTTP request.
67
68
Intended to be called by mod_python, as a handler.
69
req: An Apache request object.
71
# Make the request object into an IVLE request which can be passed to apps
76
# Pass the apachereq to error reporter, since ivle req isn't created
78
handle_unknown_exception(apachereq, *sys.exc_info())
79
# Tell Apache not to generate its own errors as well
80
return mod_python.apache.OK
82
# Run the main handler, and catch all exceptions
84
return handler_(req, apachereq)
85
except mod_python.apache.SERVER_RETURN:
86
# An apache error. We discourage these, but they might still happen.
90
handle_unknown_exception(req, *sys.exc_info())
91
# Tell Apache not to generate its own errors as well
92
return mod_python.apache.OK
94
def handler_(req, apachereq):
96
Nested handler function. May raise exceptions. The top-level handler is
97
just used to catch exceptions.
98
Takes both an IVLE request and an Apache req.
70
@param apachereq: An Apache request object.
72
# Make the request object into an IVLE request which can be given to views
73
req = Request(apachereq)
100
75
# Hack? Try and get the user login early just in case we throw an error
101
76
# (most likely 404) to stop us seeing not logged in even when we are.
102
77
if not req.publicmode: