diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-11-04 16:25:47 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-11-04 16:25:47 +0000 |
commit | c6739488e46214c3785503d220a0b3b7397a821f (patch) | |
tree | 3b55c91fd681656bf35254f6344a3b27699f03f9 /src/lib/Server/Plugins | |
parent | ea23e67cb34e599b899afeb56f63726bf6be9157 (diff) | |
download | bcfg2-c6739488e46214c3785503d220a0b3b7397a821f.tar.gz bcfg2-c6739488e46214c3785503d220a0b3b7397a821f.tar.bz2 bcfg2-c6739488e46214c3785503d220a0b3b7397a821f.zip |
TCheetah: Use an explicit searchlist for variable resolution, which gets propagated to #included templates
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4960 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r-- | src/lib/Server/Plugins/TCheetah.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py index b36e05f89..1277ce390 100644 --- a/src/lib/Server/Plugins/TCheetah.py +++ b/src/lib/Server/Plugins/TCheetah.py @@ -15,6 +15,7 @@ class TemplateFile: self.specific = specific self.encoding = encoding self.template = None + self.searchlist = {'properties': properties} def handle_event(self, event): '''Handle all fs events for this template''' @@ -23,8 +24,9 @@ class TemplateFile: try: s = {'useStackFrames': False} self.template = Cheetah.Template.Template(open(self.name).read(), - compilerSettings=s) - self.template.properties = self.properties.properties + compilerSettings=s, + searchList = [self.searchlist]) + except Cheetah.Parser.ParseError, perror: logger.error("Cheetah parse error for file %s" % (self.name)) logger.error(perror.report()) @@ -32,8 +34,11 @@ class TemplateFile: def bind_entry(self, entry, metadata): '''Build literal file information''' self.template.metadata = metadata + self.searchlist['metadata'] = metadata self.template.path = entry.get('realname', entry.get('name')) + self.searchlist['path'] = entry.get('realname', entry.get('name')) self.template.source_path = self.name + self.searchlist['source_path'] = self.name try: if type(self.template) == unicode: @@ -45,7 +50,7 @@ class TemplateFile: (a, b, c) = sys.exc_info() msg = traceback.format_exception(a, b, c, limit=2)[-1][:-1] logger.error(msg) - logger.error("TCheetah template error for %s" % self.template.path) + logger.error("TCheetah template error for %s" % self.searchlist['path']) del a, b, c raise Bcfg2.Server.Plugin.PluginExecutionError |