zope.pagetemplatefile.PageTemplateFile strips out Content-type <meta> tag

Bug #920495 reported by Miano Njoka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.pagetemplate
Invalid
Undecided
Unassigned

Bug Description

Is there a reason for stripping out of the Content-type <meta> tag from ZPT templates? This is done in the _prepare_html function in zope.pagetemplatefile.PageTemplateFile. My application produces XHTML that contains non-ASCII characters that is then used in other applications so it needs to have the content type set on the document itself in addition to the HTTP headers.

Second, finding and stripping of the meta tag is done using a regular expression which is incorrect because simply changing the order of the attributes on the <meta> tag would make the reg-exp not match.

Thanks.

Revision history for this message
Miano Njoka (mianonjoka) wrote :

The patch attached uses HTMLParser to get the meta content type tag information in the HTML if it exists and leaves it in the text. Also changed the tests to take into account that the meta tag is left in the HTML.

Revision history for this message
Colin Watson (cjwatson) wrote :

The zope.pagetemplate project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope.pagetemplate.

Changed in zope.pagetemplate:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.