diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-10-07 14:46:08 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-10-07 14:46:08 +0000 |
commit | eac52c270b8b3b10e461bc46502b64c5f898bd7d (patch) | |
tree | 96da2e78af41305b445de23596b75bf754eedbbc /src/lib/Server/Plugins/TCheetah.py | |
parent | e686d3b69600441e943c2913542e5477af528d87 (diff) | |
download | bcfg2-eac52c270b8b3b10e461bc46502b64c5f898bd7d.tar.gz bcfg2-eac52c270b8b3b10e461bc46502b64c5f898bd7d.tar.bz2 bcfg2-eac52c270b8b3b10e461bc46502b64c5f898bd7d.zip |
Pylint/PEP 8 Code cleanups
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5477 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/TCheetah.py')
-rw-r--r-- | src/lib/Server/Plugins/TCheetah.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py index 87358684c..9988b80e4 100644 --- a/src/lib/Server/Plugins/TCheetah.py +++ b/src/lib/Server/Plugins/TCheetah.py @@ -15,15 +15,17 @@ except: logger.error("TCheetah: Failed to import Cheetah. Is it installed?") raise + class TemplateFile: '''Template file creates Cheetah template structures for the loaded file''' + def __init__(self, name, specific, encoding): self.name = name self.specific = specific self.encoding = encoding self.template = None self.searchlist = dict() - + def handle_event(self, event): '''Handle all fs events for this template''' if event.code2str() == 'deleted': @@ -36,7 +38,7 @@ class TemplateFile: except Cheetah.Parser.ParseError, perror: logger.error("Cheetah parse error for file %s" % (self.name)) logger.error(perror.report()) - + def bind_entry(self, entry, metadata): '''Build literal file information''' self.template.metadata = metadata @@ -45,11 +47,11 @@ class TemplateFile: 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: entry.text = self.template - else : + else: entry.text = unicode(str(self.template), self.encoding) except: (a, b, c) = sys.exc_info() |