diff options
Diffstat (limited to 'src/lib/Server/Plugins/TGenshi.py')
-rw-r--r-- | src/lib/Server/Plugins/TGenshi.py | 11 |
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 |