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

« back to all changes in this revision

Viewing changes to lib/common/user.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:
72
72
        items = ["%s=%s" % (r, repr(self.__getattribute__(r)))
73
73
            for r in user_fields_list]
74
74
        return "User(" + ', '.join(items) + ")"
 
75
    def __iter__(self):
 
76
        """Iteration yielding field:value pairs.
 
77
        (Allows the "dict" function to work on Users)
 
78
        """
 
79
        for r in user_fields_list:
 
80
            yield (r, self.__getattribute__(r))
75
81
 
76
82
    def hasCap(self, capability):
77
83
        """Given a capability (which is a Role object), returns True if this