[Zope-dev] [Zope 2.10] ZPT going Unicode

Tino Wildenhain tino at wildenhain.de
Sun Jan 15 07:20:47 EST 2006


Dieter Maurer schrieb:
> Tino Wildenhain wrote at 2006-1-13 16:45 +0100:
> 
>>...
>>Maybe just have new uZPT with Unicode and leave the "old" ZPT allone?
>>Maybe with limited ability to "add" old ZPT from ZMI or such.
>>
>>This would solve the backward-compatibility problems and would be a more
>>smooth transition w/o the need of upgrade hacks and "strict" hacks
>>(after all, we arent perl/php ;))
> 
> 
> I fear it is not that easy:
> 
>   Unless we set Python's "defaultencoding" to the site encoding
>   (and we have such a thing), Python cannot mix Unicode and non-Unicode.
> 
>   Thus, your "old" ZPT's would need to use only other old ZPT's and
>   "old" Python scripts and "old" methods (returning encoded texts)
>   while "strict" ZPT's would need to use only new (strict) ZPT's, scripts
>   and methods. Quite unfeasible...

Dont think so. The uZPTs would be aware of the fact of "unfriendly"
environment. So handling of encoded templates can be done when they
are used in a uZPT they would be promoted to unicode w/o touching the
default python encoding. (If not unicode ... get encoding from template
or site-default -> decode)

Mixing all that capabilty with a single "switchable" ZPT implementation
strikes me a lot harder to get right, useable and performant.

But after all its just an idea. We can discuss it ;)

++Tino


More information about the Zope-Dev mailing list