remotemetadata cleanup
- dont overwrite metadata if lookup does not return anything - make find fail without error
This commit is contained in:
parent
0ec527dd02
commit
67788f2a04
2 changed files with 4 additions and 3 deletions
|
@ -321,6 +321,7 @@ class Item(db.Model):
|
||||||
logger.debug('scrape %s', primaryid)
|
logger.debug('scrape %s', primaryid)
|
||||||
if primaryid:
|
if primaryid:
|
||||||
m = meta.lookup(*primaryid)
|
m = meta.lookup(*primaryid)
|
||||||
|
if m:
|
||||||
m['primaryid'] = primaryid
|
m['primaryid'] = primaryid
|
||||||
self.meta = m
|
self.meta = m
|
||||||
self.update()
|
self.update()
|
||||||
|
|
|
@ -23,7 +23,7 @@ def request(action, data):
|
||||||
|
|
||||||
def find(query):
|
def find(query):
|
||||||
logger.debug('find %s', query)
|
logger.debug('find %s', query)
|
||||||
return request('findMetadata', {'query': query})['items']
|
return request('findMetadata', {'query': query}).get('items', [])
|
||||||
|
|
||||||
def lookup(key, value):
|
def lookup(key, value):
|
||||||
logger.debug('lookup %s %s', key, value)
|
logger.debug('lookup %s %s', key, value)
|
||||||
|
|
Loading…
Reference in a new issue