42
42
from ivle import util
45
44
from ivle.dispatch.request import Request
46
45
from ivle.dispatch import login
47
46
from ivle.webapp.base.plugins import ViewPlugin, PublicViewPlugin
48
47
from ivle.webapp.errors import HTTPError, Unauthorized
52
50
def generate_route_mapper(view_plugins, attr):
164
161
req.store.commit()
167
# We had no matching URL! Check if it matches an old-style app. If
169
if req.app not in ivle.conf.apps.app_url:
170
return req.HTTP_NOT_FOUND # TODO: Prettify.
171
### END New plugins framework ###
174
### BEGIN legacy application framework ###
175
# We have no public apps back here.
176
assert not req.publicmode
178
# app is the App object for the chosen app
180
app = ivle.conf.apps.app_url[ivle.conf.apps.default_app]
182
app = ivle.conf.apps.app_url[req.app]
184
# Check if app requires auth. If so, perform authentication and login.
185
# This will either return a User object, None, or perform a redirect
186
# which we will not catch here.
188
logged_in = req.user is not None
192
assert logged_in # XXX
195
# Keep the user's session alive by writing to the session object.
196
# req.get_session().save()
197
# Well, it's a fine idea, but it creates considerable grief in the
198
# concurrent update department, so instead, we'll just make the
199
# sessions not time out.
200
req.get_session().unlock()
202
# Call the specified app with the request object
203
apps.call_app(app.dir, req)
205
# MAKE SURE we write the HTTP (and possibly HTML) header. This
206
# wouldn't happen if nothing else ever got written, so we have to make
208
req.ensure_headers_written()
210
# When done, write out the HTML footer if the app has requested it
211
if req.write_html_head_foot:
212
html.write_html_foot(req)
214
# Note: Apache will not write custom HTML error messages here.
215
# Use req.throw_error to do that.
164
return req.HTTP_NOT_FOUND # TODO: Prettify.
218
166
def handle_unknown_exception(req, exc_type, exc_value, exc_traceback):