From eac52c270b8b3b10e461bc46502b64c5f898bd7d Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 7 Oct 2009 14:46:08 +0000 Subject: Pylint/PEP 8 Code cleanups Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5477 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/TGenshi.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/lib/Server/Plugins/TGenshi.py') diff --git a/src/lib/Server/Plugins/TGenshi.py b/src/lib/Server/Plugins/TGenshi.py index 4bec8b2f1..b38bdfb0b 100644 --- a/src/lib/Server/Plugins/TGenshi.py +++ b/src/lib/Server/Plugins/TGenshi.py @@ -10,10 +10,12 @@ except: have_ntt = False import logging import Bcfg2.Server.Plugin -import genshi.core, genshi.input +import genshi.core +import genshi.input logger = logging.getLogger('Bcfg2.Plugins.TGenshi') + def removecomment(stream): """A genshi filter that removes comments from the stream.""" for kind, data, pos in stream: @@ -21,8 +23,10 @@ def removecomment(stream): continue yield kind, data, pos + class TemplateFile: '''Template file creates Genshi template structures for the loaded file''' + def __init__(self, name, specific, encoding): self.name = name self.specific = specific @@ -43,7 +47,7 @@ class TemplateFile: else: self.template_cls = MarkupTemplate self.HandleEvent = self.handle_event - + def handle_event(self, event=None): '''Handle all fs events for this template''' if event and event.code2str() == 'deleted': @@ -59,7 +63,7 @@ class TemplateFile: logger.error('Genshi template error: %s' % terror) except genshi.input.ParseError, perror: logger.error('Genshi parse error: %s' % perror) - + def bind_entry(self, entry, metadata): '''Build literal file information''' fname = entry.get('realname', entry.get('name')) @@ -96,6 +100,7 @@ class TemplateFile: logger.error('Genshi template loading error: %s' % err) raise Bcfg2.Server.Plugin.PluginExecutionError + class TGenshi(Bcfg2.Server.Plugin.GroupSpool): ''' The TGenshi generator implements a templating -- cgit v1.2.3-1-g7c22