Am 10.01.2008 um 13:13 schrieb Hanno Schlichting:

ZPT uses Unicode internally in Zope 2.10 and newer, so you need to decode your non-unicode values before passing them into a Page Template.

... using something like CMFDefault.utils.decode() assuming it knows how to handle the particular object it is receiving.

My current bugbear is that <tal:content="string:${result/firstname} {result/lastname}"> behaves differently to <tal:content="python: %s % (result['firstname'], result['lastname'])">

I think this is a ZPT bug but haven't been able to delve deep enough to confirm this and provide a test and posible fix. It looks like I might have some time next week.

Plone hacks the TAL engine in horrible ways so you can still use utf-8 encoded strings as well, but I wouldn't recommend this approach for a small application.

While I'm currently working on a Plone site most of my work is Zope + CMF

However, I think the error is raised because utils.decode simply returns any values untouched it doesn't know what to do with which is why I think it might be worth extending. OTOH it might something that is better fixed in the Shared.RDBMS.Results module

The database connection layer is the I/O boundary in this case and the decoding to Unicode should happen here. Pretty much all code in Zope2's SQL or database layers doesn't do this and I haven't seen much interest from anyone to fix this.

No, there isn't much interest in fixing anything on the Shared.RDBMS side which is a pity because Zope is really good for RDBMS integration. Personally I'm very interested in improving this side of things like using positional parameters. Is Shared.RDBMS.Results.Results a good place to start so that the various DAs don't need to worry about it.

I'd highly recommend using one of the approaches based on sqlalchemy, as otherwise you'll probably end up fixing a number of bugs and adding missing features to the various products responsible for Zope2's current DB interconnection features.


As I said, the mxODBC Zope DA actually has the methods to do this but, because of missing security declarations, you currently can't call them from restricted code but this is going to change in the next release.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to