From 50bb40291c7807db4021e5b79437c713602cd3bf Mon Sep 17 00:00:00 2001 From: j Date: Thu, 23 Feb 2017 16:32:52 +0100 Subject: [PATCH] fix home --- pandora/home/models.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/pandora/home/models.py b/pandora/home/models.py index fc4ac1c5..5409adfa 100644 --- a/pandora/home/models.py +++ b/pandora/home/models.py @@ -48,9 +48,8 @@ class Item(models.Model): return False self.data[key] = data[key] if key == 'contentid': - try: - content = self.get_content() - except: + content = self.get_content() + if not content: return False changed = True if 'type' in data: @@ -101,18 +100,21 @@ class Item(models.Model): return None data = None content = None - if type == 'list': - content = List.get(contentid) - data = content.json(keys=content_keys) - data['link'] = '/list==' + quote(data['user'] + ':' + data['name']) - elif type == 'edit': - content = Edit.get(contentid) - data = content.json(keys=content_keys) - data['link'] = '/edits/' + quote(data['user'] + ':' + data['name']) - elif type == 'collection': - content = Collection.get(contentid) - data = content.json(keys=content_keys) - data['link'] = '/documents/collection==' + quote(data['user'] + ':' + data['name']) + try: + if type == 'list': + content = List.get(contentid) + data = content.json(keys=content_keys) + data['link'] = '/list==' + quote(data['user'] + ':' + data['name']) + elif type == 'edit': + content = Edit.get(contentid) + data = content.json(keys=content_keys) + data['link'] = '/edits/' + quote(data['user'] + ':' + data['name']) + elif type == 'collection': + content = Collection.get(contentid) + data = content.json(keys=content_keys) + data['link'] = '/documents/collection==' + quote(data['user'] + ':' + data['name']) + except: + return None if content and content.status == 'private': self.delete() data = None