From 1e192d0693effd8ef4759dec3d713077dc83349d Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Sat, 6 Jul 2013 01:12:45 +0200 Subject: [PATCH] Added __str__() and __repr__() to people.User() --- diaspy/people.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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() -- 2.25.1