Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Andreas Jung
-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('
 ','nbsp;')
 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.

- -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-
attachment: lists.vcf___
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 )


Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Peter Bengtsson
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('
 ','nbsp;')
 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 'nbsp;' 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 )


Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Peter Bengtsson wrote:

 
 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 'nbsp;' inside the TALES expression was converted to 
 0xa0
 
 

The traceback speaks of 0xc2.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvcPUcACgkQCJIWIbr9KYzw8ACgvySZqOCv2eN8WZPEu2Iifvwz
XiAAnj5FGC8gD92HerPslMNFIrVN4zWR
=EInK
-END PGP SIGNATURE-
attachment: lists.vcf___
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 )


Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andreas Jung wrote:
 Peter Bengtsson wrote:
 
 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 'nbsp;' inside the TALES expression was converted to 
 0xa0
 
 
 The traceback speaks of 0xc2.
 
 -aj
And please file a bug report with a reproducable minimal testcase.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvcQVwACgkQCJIWIbr9KYxO3QCeIf4HsId0ljSIQs316yvtHvBZ
aJQAoOmdK1lVxJgsM513B9J2IybSuPnu
=Owd4
-END PGP SIGNATURE-
attachment: lists.vcf___
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 )


Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Peter Bengtsson
On 1 May 2010 15:40, Andreas Jung li...@zopyx.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Peter Bengtsson wrote:


 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 'nbsp;' inside the TALES expression was converted to 
 0xa0



 The traceback speaks of 0xc2.

I know. There is no such character in my source code. Somewhere TAL
converts 'nbsp;' to 0xc2

If it's not a matter of configuration I can make a bug report.

 - -aj
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (Darwin)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAkvcPUcACgkQCJIWIbr9KYzw8ACgvySZqOCv2eN8WZPEu2Iifvwz
 XiAAnj5FGC8gD92HerPslMNFIrVN4zWR
 =EInK
 -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 )


Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Peter Bengtsson wrote:
 On 1 May 2010 15:40, Andreas Jung li...@zopyx.com wrote:
 Peter Bengtsson wrote:
 
 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 'nbsp;' inside the TALES expression was converted 
 to 0xa0

 The traceback speaks of 0xc2.
 
 I know. There is no such character in my source code. Somewhere TAL
 converts 'nbsp;' to 0xc2

I can not believe that this is related to nbsp. The numeric entity
representation for that is #160; which related to 0xa0. That's
confusing me...please reduce this to a minimal test.

Andreas




-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvcRBAACgkQCJIWIbr9KYzfogCgz5/AZ2OLhjhCDDE2heNcMgn+
gM4AnRRRBOf6VjFh0Cvxd9TQSt5zBMOf
=VTl7
-END PGP SIGNATURE-
attachment: lists.vcf___
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 )


Re: [Zope] Zope 2.12 and ZPT

2010-05-01 Thread Tres Seaver
-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(' ',' ')

Note:  no 'nbsp;' in that expression.

   Module PythonExpr, line 1, in expression
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
 0: ordinal not in range(128)

This says that the title_or_id method is returning a non-ASDII value,
which, after the 'replace' method of the string runs, can't be inlined
into the template.  Try something like:

 here.getRoot().title_or_id().decode('utf8').replace(' ', 'nbsp;')

 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('
 ','nbsp;')
 Stupid and easy to fix; maybe but what if there are other problems like this?
 
 What's the cause of this? Do I have to set something special up in
 zope.conf just for Page Templates to not convert 'nbsp;' into
 '\xa0\xc2'?

Try installing the PDBDebugMode product in your instance and have a look
at the offending value live.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  tsea...@palladion.com
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEUEARECAAYFAkvcXrkACgkQ+gerLs4ltQ6TwQCUDeor2+DpEp4caEaOrxeYE8E4
oACdEmhHgi3gxqmionn4cfFDg9n1sl8=
=M8yp
-END PGP SIGNATURE-

___
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 )