From a96d2a2a859042a733f51141b94201f598dc8881 Mon Sep 17 00:00:00 2001 From: Marnanel Thurman Date: Wed, 29 May 2019 01:08:07 +0100 Subject: [PATCH] __str__() split into __str__() and __repr__(). RemoteItem param is str()ified before use. --- django_kepi/find.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/django_kepi/find.py b/django_kepi/find.py index accf4a2..110d3cf 100644 --- a/django_kepi/find.py +++ b/django_kepi/find.py @@ -11,7 +11,7 @@ logger = logging.getLogger(name='django_kepi') class RemoteItem(dict): def __init__(self, body): - self.update(json.loads(body)) + self.update(json.loads(str(body))) class CachedRemoteText(models.Model): @@ -29,10 +29,16 @@ class CachedRemoteText(models.Model): return self.content is None def __str__(self): - if self.key is None: - return '(%s: "%s")' % (self.owner, self.content[:20]) + if self.content is not None: + return self.content else: - return '(%s is GONE)' % (self.owner) + return '' + + def __repr__(self): + if self.content is not None: + return '(%s: "%s")' % (self.address, self.content[:20]) + else: + return '(%s is GONE)' % (self.address) @classmethod def fetch(cls,