[z3-checkins] r55562 - z3/deliverance/sandboxes/paul/dvplone/lib

paul at codespeak.net paul at codespeak.net
Wed Jun 4 18:04:44 CEST 2008


Author: paul
Date: Wed Jun  4 18:04:43 2008
New Revision: 55562

Added:
   z3/deliverance/sandboxes/paul/dvplone/lib/dvngfilter.py
Modified:
   z3/deliverance/sandboxes/paul/dvplone/lib/dvswitcher.py
Log:
Breaking into a module for the DVNG filter and a module for the pretend-Plone WSGI app

Added: z3/deliverance/sandboxes/paul/dvplone/lib/dvngfilter.py
==============================================================================
--- (empty file)
+++ z3/deliverance/sandboxes/paul/dvplone/lib/dvngfilter.py	Wed Jun  4 18:04:43 2008
@@ -0,0 +1,27 @@
+"""WSGI middleware to switch Deliverance themes"""
+
+from dvngcompiler import DVNG
+import os
+import lxml.html
+from lxml import etree
+from wsgifilter import Filter
+
+class DVNGFilter(Filter):
+
+    def __init__(self, app, etcdir):
+        self.app = app
+        themesetfn = os.path.join(etcdir, "themeset1.xml")
+        self.dvng = DVNG(themesetfn)
+
+        # Make an XSLT processor from the compiled theme
+        self.processor = etree.XSLT(self.dvng.xslt)
+
+    def filter(self, environ, headers, data):
+
+        # Turn incoming HTML4 data into etree, apply XSLT
+        htmldoc = lxml.html.document_fromstring(data)
+        result = self.processor(htmldoc)
+        response = str(result)
+        return response
+
+

Modified: z3/deliverance/sandboxes/paul/dvplone/lib/dvswitcher.py
==============================================================================
--- z3/deliverance/sandboxes/paul/dvplone/lib/dvswitcher.py	(original)
+++ z3/deliverance/sandboxes/paul/dvplone/lib/dvswitcher.py	Wed Jun  4 18:04:43 2008
@@ -1,32 +1,6 @@
 """WSGI middleware to switch Deliverance themes"""
 
-from dvngcompiler import DVNG
-import os
-import lxml.html
-from lxml import etree
-from wsgifilter import Filter
-
-class DVNGFilter(Filter):
-
-    def __init__(self, app, etcdir):
-        self.app = app
-        themesetfn = os.path.join(etcdir, "themeset1.xml")
-        self.dvng = DVNG(themesetfn)
-
-        # Make an XSLT processor from the compiled theme
-        self.processor = etree.XSLT(self.dvng.xslt)
-
-    def filter(self, environ, headers, data):
-
-        # Turn incoming HTML4 data into etree, apply XSLT
-        htmldoc = lxml.html.document_fromstring(data)
-        result = self.processor(htmldoc)
-        response = str(result)
-        return response
-
-#    def __call__(self, environ, start_response):
-#        response_iter = self.app(environ, start_response)
-#        return response_iter
+from dvngfilter import DVNGFilter
 
 def make_dvng(app, global_conf, **kw):
     """Choose which Deliverance theme should be used"""


More information about the z3-checkins mailing list