[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/ Allow specifying the parser in the template loader

Wichert Akkerman wichert at wiggy.net
Sat Aug 16 04:55:20 EDT 2008


Log message for revision 89910:
  Allow specifying the parser in the template loader

Changed:
  U   z3c.pt/trunk/src/z3c/pt/genshi.txt
  U   z3c.pt/trunk/src/z3c/pt/loader.py

-=-
Modified: z3c.pt/trunk/src/z3c/pt/genshi.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/genshi.txt	2008-08-16 08:38:52 UTC (rev 89909)
+++ z3c.pt/trunk/src/z3c/pt/genshi.txt	2008-08-16 08:55:19 UTC (rev 89910)
@@ -150,24 +150,7 @@
     </blockquote>
   </div>
 
-    
-  >>> print render_genshi("""\
-  ... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  ...     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-  ... <html xmlns="http://www.w3.org/1999/xhtml"
-  ...       xmlns:py="http://genshi.edgewall.org">
-  ...  <body py:with="bla=1">
-  ...     <em>${bla}</em>
-  ...   </body>
-  ... </html>""")
-  <html>
-    <body>
-      <em>1</em>
-    </body>
-  </html>
   
-  
-  
 py:attrs
   
   >>> print render_genshi("""\

Modified: z3c.pt/trunk/src/z3c/pt/loader.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/loader.py	2008-08-16 08:38:52 UTC (rev 89909)
+++ z3c.pt/trunk/src/z3c/pt/loader.py	2008-08-16 08:55:19 UTC (rev 89910)
@@ -7,7 +7,7 @@
     """Template loader tool.
     """
 
-    def __init__(self, search_path=None, auto_reload=False, cachedir=None):
+    def __init__(self, search_path=None, auto_reload=False, cachedir=None, parser=None):
         if search_path is None:
             search_path = []
         if isinstance(search_path, basestring):
@@ -15,6 +15,7 @@
         self.search_path = search_path
         self.auto_reload = auto_reload
         self.cachedir = cachedir
+        self.parser = parser
         if cachedir is not None:
             if not os.path.isdir(cachedir):
                 raise ValueError("Invalid cachedir")
@@ -28,7 +29,7 @@
             path = os.path.join(path, filename)
             try:
                 return klass(path, auto_reload=self.auto_reload,
-                                cachedir=self.cachedir)
+                                cachedir=self.cachedir, parser=self.parser)
             except OSError, e:
                 if e.errno != errno.ENOENT:
                     raise



More information about the Checkins mailing list