From: Marek Marecki Date: Sun, 23 Apr 2017 13:43:44 +0000 (+0200) Subject: Better (safer) stringification of users X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0f452d5d41fdf4bb948a8dddb6eef43eaaf92612;p=diaspy.git Better (safer) stringification of users --- diff --git a/diaspy/people.py b/diaspy/people.py index 701a02c..7ebf2a3 100644 --- a/diaspy/people.py +++ b/diaspy/people.py @@ -76,10 +76,10 @@ class User(): return self.data[key] def __str__(self): - return self['guid'] + return self.data.get('guid', '') def __repr__(self): - return '{0} ({1})'.format(self['handle'], self['guid']) + return '{0} ({1})'.format(self.handle(), self.guid()) def handle(self): return self.data.get('diaspora_id', 'Unknown handle')