From 255d84bc882f35cccc9d37b02bdc61e939a37655 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 19 Jun 2019 12:55:09 -0700 Subject: [PATCH] Add source to tags automatically --- inquisitor/item.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inquisitor/item.py b/inquisitor/item.py index 8665372..ab80f02 100644 --- a/inquisitor/item.py +++ b/inquisitor/item.py @@ -9,6 +9,9 @@ logger = logging.getLogger("inquisitor.item") def create_item(source, item_id, title, link=None, ts=None, author=None, body=None, tags=None): import time + taglist = tags or [] + if source not in taglist: + taglist.append(source) item = { 'id': item_id, 'source': source, @@ -19,7 +22,7 @@ def create_item(source, item_id, title, link=None, ts=None, author=None, body=No 'time': ts, 'author': author, 'body': body, - 'tags': [] if tags is None else tags, + 'tags': taglist, } return item