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/SGenshi.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/lib/Server/Plugins/SGenshi.py') diff --git a/src/lib/Server/Plugins/SGenshi.py b/src/lib/Server/Plugins/SGenshi.py index 6c06a25d0..6f17e5ede 100644 --- a/src/lib/Server/Plugins/SGenshi.py +++ b/src/lib/Server/Plugins/SGenshi.py @@ -1,13 +1,18 @@ '''This module implements a templating generator based on Genshi''' __revision__ = '$Revision$' -import Bcfg2.Server.Plugin, Bcfg2.Server.Plugins.TGenshi -import lxml.etree, logging import genshi.template +import lxml.etree +import logging + +import Bcfg2.Server.Plugin +import Bcfg2.Server.Plugins.TGenshi logger = logging.getLogger('Bcfg2.Plugins.SGenshi') + class SGenshiTemplateFile(Bcfg2.Server.Plugins.TGenshi.TemplateFile): + def get_xml_value(self, metadata): if not hasattr(self, 'template'): logger.error("No parsed template information for %s" % (self.name)) @@ -17,10 +22,12 @@ class SGenshiTemplateFile(Bcfg2.Server.Plugins.TGenshi.TemplateFile): data = stream.render('xml', strip_whitespace=False) return lxml.etree.XML(data) + class SGenshiEntrySet(Bcfg2.Server.Plugin.EntrySet): + def __init__(self, path, fam, encoding): fpattern = '\S+\.xml' - Bcfg2.Server.Plugin.EntrySet.__init__(self, fpattern, path, + Bcfg2.Server.Plugin.EntrySet.__init__(self, fpattern, path, SGenshiTemplateFile, encoding) fam.AddMonitor(path, self) @@ -40,6 +47,7 @@ class SGenshiEntrySet(Bcfg2.Server.Plugin.EntrySet): logger.error("SGenshi: Failed to template file %s" % entry.name) return ret + class SGenshi(SGenshiEntrySet, Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Structure): @@ -58,5 +66,3 @@ class SGenshi(SGenshiEntrySet, logger.error("Failed to load %s repository; disabling %s" \ % (self.name, self.name)) raise Bcfg2.Server.Plugin.PluginInitError - - -- cgit v1.2.3-1-g7c22