From: Marek Marecki Date: Fri, 5 Jul 2013 23:12:45 +0000 (+0200) Subject: Added __str__() and __repr__() to people.User() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1e192d0693effd8ef4759dec3d713077dc83349d;p=diaspy.git Added __str__() and __repr__() to people.User() --- diff --git a/diaspy/people.py b/diaspy/people.py index 8107ab2..25677fb 100644 --- a/diaspy/people.py +++ b/diaspy/people.py @@ -31,13 +31,19 @@ class User(): self.data = { 'guid': guid, 'handle': handle, - 'id': id + 'id': id, } self._do_fetch(fetch) def __getitem__(self, key): return self.data[key] + def __str__(self): + return self['guid'] + + def __repr__(self): + return '{0} ({1})'.format(self['diaspora_name'], self['guid']) + def _do_fetch(self, fetch): if fetch == 'posts': if self['handle'] and self['guid']: self.fetchguid()