summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/SGenshi.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugins/SGenshi.py')
-rw-r--r--src/lib/Server/Plugins/SGenshi.py16
1 files changed, 11 insertions, 5 deletions
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
-
-