Make all lookup plugins work with lists

Lookup plugins should accept a string or a list, and always return
a list, even if it is just one item.
This commit is contained in:
Daniel Hokka Zakrisson 2012-12-05 12:26:23 +01:00
commit b73016b881
9 changed files with 101 additions and 68 deletions

View file

@ -23,5 +23,9 @@ class LookupModule(object):
self.basedir = basedir
def run(self, terms, inject=None, **kwargs):
return utils.template_from_file(self.basedir, terms, inject)
if isinstance(terms, basestring):
terms = [ terms ]
ret = []
for term in terms:
ret.append(utils.template_from_file(self.basedir, term, inject))
return ret