59
59
# TODO: Nicer 404 message?
60
60
req.throw_error(Request.HTTP_NOT_FOUND)
62
# Special handling for public mode - just call public app and get out
63
# NOTE: This will not behave correctly if the public app uses
64
# write_html_head_foot, but "serve" does not.
66
app = conf.apps.app_url[conf.apps.public_app]
67
apps.call_app(app.dir, req)
62
70
# app is the App object for the chosen app
63
71
if req.app is None:
64
app = conf.apps.app_url[conf.default_app]
72
app = conf.apps.app_url[conf.apps.default_app]
66
74
app = conf.apps.app_url[req.app]
68
76
# Check if app requires auth. If so, perform authentication and login.
77
# This will either return a User object, None, or perform a redirect
78
# which we will not catch here.
69
79
if app.requireauth:
70
req.username = login.login(req)
71
logged_in = req.username is not None
80
req.user = login.login(req)
81
logged_in = req.user is not None
73
req.username = login.get_username(req)
83
req.user = login.get_user_details(req)
87
# Keep the user's session alive by writing to the session object.
88
# req.get_session().save()
89
# Well, it's a fine idea, but it creates considerable grief in the
90
# concurrent update department, so instead, we'll just make the
91
# sessions not time out.
77
93
# If user did not specify an app, HTTP redirect to default app and
79
95
if req.app is None:
80
req.throw_redirect(util.make_path(conf.default_app))
96
req.throw_redirect(util.make_path(conf.apps.default_app))
82
98
# Set the default title to the app's tab name, if any. Otherwise URL