Commit 804b1302 by Seth Vidal

check if the term is a dict so we can take a simple list of files (like first_available_file) takes

parent dfad9407
...@@ -81,34 +81,36 @@ class LookupModule(object): ...@@ -81,34 +81,36 @@ class LookupModule(object):
def run(self, terms, **kwargs): def run(self, terms, **kwargs):
result = None result = None
for term in terms: for term in terms:
files = term.get('files', []) if isinstance(term, dict):
paths = term.get('paths', []) files = term.get('files', [])
paths = term.get('paths', [])
filelist = files
if isinstance(files, basestring): filelist = files
files = files.replace(',', ' ') if isinstance(files, basestring):
files = files.replace(';', ' ') files = files.replace(',', ' ')
filelist = files.split(' ') files = files.replace(';', ' ')
filelist = files.split(' ')
pathlist = paths
if paths: pathlist = paths
if isinstance(paths, basestring): if paths:
paths = paths.replace(',', ' ') if isinstance(paths, basestring):
paths = paths.replace(':', ' ') paths = paths.replace(',', ' ')
paths = paths.replace(';', ' ') paths = paths.replace(':', ' ')
pathlist = paths.split(' ') paths = paths.replace(';', ' ')
pathlist = paths.split(' ')
total_search = []
total_search = []
if not pathlist:
total_search = filelist if not pathlist:
total_search = filelist
else:
for path in pathlist:
for fn in filelist:
f = path + '/' + fn
total_search.append(f)
else: else:
for path in pathlist: total_search = [term]
for fn in filelist:
f = path + '/' + fn
total_search.append(f)
result = None result = None
for fn in total_search: for fn in total_search:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment