How can I get the result of a template without HTML-Tags?
When I use the following view SituationView with a plain text template situation.pt I get a result with HTML-Tags.
# view.py
class SituationView(ViewMixinForTemplates, BrowserView):
index = ViewPageTemplateFile("situation.pt")
# setting the content_type to 'text/plain' returns html-tags too.
# index = ViewPageTemplateFile("situation.pt", content_type='text/plain')
# situation.pt
some text
$ curl "http://localhost:8081/Plone/de/situation/@@situation-view"
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><body><p>some text
</p></body></html>
the value of the header X-Theme-Disabled is irrelevant for disabling the theme
theming can also be disabled using the request parameter diazo.off. In my example above: http://localhost:8081/Plone/de/situation/@@situation-view?diazo.off=true.
def isThemeEnabled(self, settings=None):
"""Whether theming is enabled."""
...
# Disable theming if the response sets a header
if self.request.response.getHeader('X-Theme-Disabled'):
return False
# Check for diazo.off request parameter
true_vals = ('1', 'y', 'yes', 't', 'true')
if (debug_mode and self.request.get(
'diazo.off', '').lower() in true_vals):
return False