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

« back to all changes in this revision

Viewing changes to www/dispatch/__init__.py

  • Committer: mattgiuca
  • Date: 2008-02-19 06:37:34 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:504
Warning: Broken build, but rather unavoidable or this commit will spiral out
of control.

dispatch.login: Removed all the misc user values from session. Replaced with
"user" which is a User object. All the code which looks up values in session
can just look up user and read fields from it; but they don't at the moment so
they break.

dispatch: All the rest of dispatch system updated to read from user instead,
and have no dependency on the other fields in session. So the top level works
(the apps don't).

user.py: Added __iter__ method, allowing dict() to be called on a user object.

debuginfo: Added a special print table for the user fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        app = conf.apps.app_url[req.app]
75
75
 
76
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.
77
79
    if app.requireauth:
78
 
        req.username = login.login(req)
79
 
        logged_in = req.username is not None
 
80
        req.user = login.login(req)
 
81
        logged_in = req.user is not None
80
82
    else:
81
 
        req.username = login.get_username(req)
 
83
        req.user = login.get_user_details(req)
82
84
        logged_in = True
 
85
    # XXX username is deprecated
 
86
    try:
 
87
        req.username = req.user.login
 
88
    except AttributeError:
 
89
        req.username = None
83
90
 
84
91
    if logged_in:
85
92
        # Keep the user's session alive by writing to the session object.