Fred Drake wrote:
On 7/21/05, Dmitry Vasiliev <[EMAIL PROTECTED]> wrote:

Log message for revision 37358:
 Now input encoding of a PageTemplateFile in 'html' mode is determined
 by <meta> declaration and then the declaration will stripped.

 Open question:
     Shouldn't <meta>/<?xml?> stripping be in PageTemplate.__call__()?


This should be stripped by the compilation phase.  Since those should
never be part of the output, they need not be represented in the
compiled template at all.

I think about the following generic algorithm:

1. Preparation stage. Content type and encoding are determining based on the <?xml?>/<meta> declarations. In case of the 'text/html' type and a not unicoded content we decode the content. In case of the 'text/xml' type the parser takes care of the encoding at the cooking stage. We can do it somewhere inside PageTemplate.pt_edit()/PageTemplate.write() methods.

2. Cooking stage. Nothing interested for our case.

3. Rendering stage. Now we can strip the <?xml?>/<meta> declarations. We can do it somewhere inside PageTemplate.pt_render()/PageTempalte.__call__() methods.


BTW, just curious why we need to read HTML files in the text mode (See PageTemplateFile._read_file())?

--
Dmitry Vasiliev (dima at hlabs.spb.ru)
    http://hlabs.spb.ru
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to