On 1 May 2010 14:40, Andreas Jung <li...@zopyx.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Peter Bengtsson wrote: >> I'm trying to get a product running in Zope 2.12 which I installed in >> a virtualenv with easy_install. It starts fine and all but when I try >> to render a piece of ZPT I get this weird error: >> >> >> Traceback (innermost last): >> Module ZPublisher.Publish, line 127, in publish >> Module ZPublisher.mapply, line 77, in mapply >> Module ZPublisher.Publish, line 47, in call_object >> Module Products.IssueTrackerProduct.IssueTracker, line 12629, in AddIssue >> Module Shared.DC.Scripts.Bindings, line 324, in __call__ >> Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec >> Module Products.PageTemplates.PageTemplateFile, line 130, in _exec >> Module Products.PageTemplates.PageTemplate, line 80, in pt_render >> Module zope.pagetemplate.pagetemplate, line 115, in pt_render >> Module zope.tal.talinterpreter, line 271, in __call__ >> Module zope.tal.talinterpreter, line 343, in interpret >> Module zope.tal.talinterpreter, line 888, in do_useMacro >> Module zope.tal.talinterpreter, line 343, in interpret >> Module zope.tal.talinterpreter, line 533, in do_optTag_tal >> Module zope.tal.talinterpreter, line 518, in do_optTag >> Module zope.tal.talinterpreter, line 513, in no_tag >> Module zope.tal.talinterpreter, line 343, in interpret >> Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal >> Module Products.PageTemplates.Expressions, line 220, in evaluateStructure >> Module zope.tales.tales, line 696, in evaluate >> Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__ >> - __traceback_info__: here.getRoot().title_or_id().replace(' ',' ') >> Module PythonExpr, line 1, in <expression> >> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position >> 0: ordinal not in range(128) >> >> >> After a lot of trial-and-error I managed to figure out that the >> culprit was this piece of ZPT code: >> tal:content="structure python:here.getRoot().title_or_id().replace(' >> ',' ')" >> Stupid and easy to fix; maybe but what if there are other problems like this? >> >> > Likely related to the new ZPT engine since Zope 2.10. > > Either you deal with this using the unicode conflict resolver of ZPT > or ensure that you don't mix up different encodings since ZPT now uses > unicode internally. > "the unicode conflict resolver"? My app does not have any non-ascii characters until user input is added which it's programmed to work with. The problem was that ' ' inside the TALES expression was converted to 0xa0
> - -aj > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (Darwin) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkvcL2IACgkQCJIWIbr9KYzjqACfWQ+7gQO0wO2q3vFzptxvrs5Q > 7CoAnRiCa6aTeOqX58GBN9DHubwKkYr1 > =myaM > -----END PGP SIGNATURE----- > > _______________________________________________ > Zope maillist - z...@zope.org > https://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > https://mail.zope.org/mailman/listinfo/zope-announce > https://mail.zope.org/mailman/listinfo/zope-dev ) > > -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com fun crosstips.org _______________________________________________ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )