[Zope3-dev] string agnostic page templates, again

Fred Drake fdrake at gmail.com
Tue Sep 7 13:47:14 EDT 2004


On Tue, 07 Sep 2004 19:23:10 +0200, Martijn Faassen <faassen at infrae.com> wrote:
> Right; Five already exposes Zope 3's version to Zope 2, hopefully a step
> in the right direction. :)

Once we have all the issues here solved, that's probably just fine.  I
hope so, since I hope to make the TAL and Products.PageTemplates
packages thin API shims over zope.tal, zope.tales, and
zope.(app.?)pagetemplate eventually.

> What if the first thing on the stream is latin-1 and then unicode gets
> added?

Then you're hosed if you get an 8-bit character in the Latin-1, but
that seems to be the case now.  How should the TAL interpreter know
whether you're using Latin-1 or UTF-8?  I don't see a good way to deal
with this one without knowing what each bit of text is.  And the only
way to be sure of that is to use Unicode.

> What if the first thing on the stream is a non-string object?

Then it has to buffer; it can't decide what to use without some clue.

> It sounds like a good approach, just slightly worried about edge cases
> like the ones above.

We have to figure out which edge cases can be handled magically.  I
don't think the Latin-1 vs. Latin-5 vs. UTF-8 case is solvable using
magic.

> It should break horribly as soon as possible (presumably earlier than in
> .getvalue() as is happening now) as soon as encoded (non-ascii) text is
> mixed with unicode.

Once Unicode is seen, it can immediately switch to Unicode for
everything.  If we never get Unicode, we avoid the conversion
entirely.  Otherwise, we need the magic and can't generate the error
early.  So we get the error as soon as we know the target type.

> Going through some sequences, in semi-regex patterns:

Are these some sort of behavioral expectations?  Or was there an
implied question here?


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the Zope3-dev mailing list