Add source to tags automatically
This commit is contained in:
parent
ee7927ec9e
commit
255d84bc88
|
@ -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):
|
def create_item(source, item_id, title, link=None, ts=None, author=None, body=None, tags=None):
|
||||||
import time
|
import time
|
||||||
|
taglist = tags or []
|
||||||
|
if source not in taglist:
|
||||||
|
taglist.append(source)
|
||||||
item = {
|
item = {
|
||||||
'id': item_id,
|
'id': item_id,
|
||||||
'source': source,
|
'source': source,
|
||||||
|
@ -19,7 +22,7 @@ def create_item(source, item_id, title, link=None, ts=None, author=None, body=No
|
||||||
'time': ts,
|
'time': ts,
|
||||||
'author': author,
|
'author': author,
|
||||||
'body': body,
|
'body': body,
|
||||||
'tags': [] if tags is None else tags,
|
'tags': taglist,
|
||||||
}
|
}
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue