summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugin
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-22 11:16:19 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-22 11:16:19 -0500
commit22029e107420ff21cf9f1811bf4bb6dc2aba1dde (patch)
treebeec8e930b7204e64e01198e5d57b59f72ffef20 /src/lib/Bcfg2/Server/Plugin
parent1b001ee4a4d5cacab04c1e99ad4cc4ce4ca93894 (diff)
downloadbcfg2-22029e107420ff21cf9f1811bf4bb6dc2aba1dde.tar.gz
bcfg2-22029e107420ff21cf9f1811bf4bb6dc2aba1dde.tar.bz2
bcfg2-22029e107420ff21cf9f1811bf4bb6dc2aba1dde.zip
made genshi a requirement
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugin')
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index 59796a556..c85253be6 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -17,6 +17,7 @@ from Bcfg2.Server.Plugin.base import Debuggable, Plugin
from Bcfg2.Server.Plugin.interfaces import Generator
from Bcfg2.Server.Plugin.exceptions import SpecificityError, \
PluginExecutionError
+import genshi.core
try:
import Bcfg2.Encryption
@@ -33,6 +34,21 @@ except ImportError:
LOGGER = logging.getLogger(__name__)
+def removecomment(stream):
+ """ A Genshi filter that removes comments from the stream. This
+ function is a generator.
+
+ :param stream: The Genshi stream to remove comments from
+ :type stream: genshi.core.Stream
+ :returns: tuple of ``(kind, data, pos)``, as when iterating
+ through a Genshi stream
+ """
+ for kind, data, pos in stream:
+ if kind is genshi.core.COMMENT:
+ continue
+ yield kind, data, pos
+
+
def default_path_metadata():
""" Get the default Path entry metadata from the config.