Allow variables to be used raw in with_nested

This commit is contained in:
Michael DeHaan 2013-04-22 21:35:09 -04:00
parent fbea88b9d9
commit 5cced79cf3

View file

@ -42,11 +42,21 @@ class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def __lookup_injects(self, terms, inject):
results = []
for x in terms:
if isinstance(x, basestring) and x in inject:
results.append(inject[x])
else:
results.append(x)
return results
def run(self, terms, inject=None, **kwargs):
# this code is common with 'items.py' consider moving to utils if we need it again
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
terms = self.__lookup_injects(terms, inject)
my_list = terms[:]
my_list.reverse()