~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:
129
129
    # Hack? Try and get the user login early just in case we throw an error
130
130
    # (most likely 404) to stop us seeing not logged in even when we are.
131
131
    if not req.publicmode:
132
 
        req.user = login.get_user_details(req)
 
132
        user = login.get_user_details(req)
 
133
 
 
134
        # Don't set the user if it is disabled or hasn't accepted the ToS.
 
135
        if user and user.valid:
 
136
            req.user = user
133
137
 
134
138
    ### BEGIN New plugins framework ###
135
139
    # XXX This should be done ONCE per Python process, not per request.
217
221
    # This will either return a User object, None, or perform a redirect
218
222
    # which we will not catch here.
219
223
    if app.requireauth:
220
 
        req.user = login.login(req)
221
224
        logged_in = req.user is not None
222
225
    else:
223
 
        req.user = login.get_user_details(req)
224
226
        logged_in = True
225
227
 
 
228
    assert logged_in # XXX
 
229
 
226
230
    if logged_in:
227
231
        # Keep the user's session alive by writing to the session object.
228
232
        # req.get_session().save()