[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/language.py Actually commit the source, dumbo.

Stefan Eletzhofer stefan.eletzhofer at inquant.de
Tue Dec 2 08:42:37 EST 2008


Log message for revision 93541:
  Actually commit the source, dumbo.

Changed:
  A   z3c.pt/trunk/src/z3c/pt/language.py

-=-
Added: z3c.pt/trunk/src/z3c/pt/language.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/language.py	                        (rev 0)
+++ z3c.pt/trunk/src/z3c/pt/language.py	2008-12-02 13:42:37 UTC (rev 93541)
@@ -0,0 +1,51 @@
+from chameleon.core import translation
+from chameleon.core import config
+from chameleon.core import utils
+
+import chameleon.zpt.language
+
+
+class ZopePageTemplateElement(chameleon.zpt.language.ZopePageTemplateElement):
+    """Zope Page Template element.
+
+    Implements the ZPT subset of the attribute template language.
+    """
+    meta_interpolation = utils.attribute(
+        utils.meta_attr('interpolation'), default="false")
+
+class XHTMLElement(chameleon.zpt.language.XHTMLElement):
+    """XHTML namespace element."""
+    meta_interpolation = utils.attribute(
+        utils.meta_attr('interpolation'), default="false")
+
+class TALElement(chameleon.zpt.language.TALElement):
+    """TAL namespace element."""
+    meta_interpolation = utils.attribute(
+        utils.meta_attr('interpolation'), default="false")
+
+class METALElement(chameleon.zpt.language.METALElement):
+    """METAL namespace element."""
+    meta_interpolation = utils.attribute(
+        utils.meta_attr('interpolation'), default="false")
+
+class MetaElement(chameleon.zpt.language.MetaElement):
+    meta_interpolation = utils.attribute(
+        utils.meta_attr('interpolation'), default="false")
+
+class Parser(chameleon.zpt.language.Parser):
+    """Zope Page Template parser."""
+
+    element_mapping = {
+        config.XHTML_NS: {None: XHTMLElement},
+        config.META_NS: {None: MetaElement},
+        config.TAL_NS: {None: TALElement},
+        config.METAL_NS: {None: METALElement}}
+
+    fallback = XHTMLElement
+
+    default_expression = 'path'
+
+    def parse(self, body):
+        root, doctype = super(Parser, self).parse(body)
+        root.meta_translator = self.default_expression
+        return root, doctype



More information about the Checkins mailing list