Commit 281a9194 authored by Evan Simpson's avatar Evan Simpson

Added and documented the ability to control the parsing of a template as

XML or HTML with an 'is_html' property.  If this property doesn't exist,
the default content-type-sniffing behavior is used.
parent 8380b038
......@@ -87,7 +87,7 @@
HTML- and XML-based template objects using TAL, TALES, and METAL.
"""
__version__='$Revision: 1.15 $'[11:-2]
__version__='$Revision: 1.16 $'[11:-2]
import os, sys, traceback, pprint
from TAL.TALParser import TALParser
......@@ -222,7 +222,9 @@ class PageTemplate(Base):
self._v_warnings = parser.getWarnings()
def html(self):
return self.content_type == 'text/html'
if not hasattr(getattr(self, 'aq_base', self), 'is_html'):
return self.content_type == 'text/html'
return self.is_html
class _ModuleImporter:
def __getitem__(self, module):
......
......@@ -17,7 +17,15 @@ Edit View: Edit A Page Template
'Title' -- Allows you to specify the Zope title of the template.
'Content-Type' -- Allows you to specify the content-type that
will be given to renderings of this template.
will be given to renderings of this template. Also, if the
content type is 'text/html' (the default) then the template is
assumed to contain HTML, not XML. This affects both parsing
and rendering of the template, and can be overridden by giving
the template an 'is_html' property.
'Expand macros when editing' -- Allows you to turn the expansion
of METAL macros on or off. This only affects viewing of the
source code, not rendering.
Buttons and Other Form Elements
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment