summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/TGenshi.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-10-07 14:46:08 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-10-07 14:46:08 +0000
commiteac52c270b8b3b10e461bc46502b64c5f898bd7d (patch)
tree96da2e78af41305b445de23596b75bf754eedbbc /src/lib/Server/Plugins/TGenshi.py
parente686d3b69600441e943c2913542e5477af528d87 (diff)
downloadbcfg2-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/TGenshi.py')
-rw-r--r--src/lib/Server/Plugins/TGenshi.py11
1 files changed, 8 insertions, 3 deletions
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