Page Template: TALES string expr. unicode err.
Bug #246983 reported by
Nils Jungclaus
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Fix Released
|
Medium
|
LeoRochael | ||
2.12 |
Fix Released
|
Medium
|
LeoRochael | ||
2.13 |
Fix Released
|
Medium
|
LeoRochael |
Bug Description
Using results from python scripts in string-expressions fails with unicode error in Zope 2.10.x.
The following buglet show the problem:
In a page template do something like:
<div tal:define="va python: here.pscr(
tal:
where pscr is a python script that simply returns the argument
Obviously, the string returned form the python script is non unicode (utf-8 in my case) and the string expression tries to insert the value into a unicode string.
Changed in zope2: | |
assignee: | nobody → ajung |
To post a comment you must log in.
Exception raised:
File "/opt/python- 2.4.4/lib/ python2. 4/unittest. py", line 260, in run develop/ sandboxes/ Zope/Zope/ lib/python/ Products/ PageTemplates/ tests/testZopeP ageTemplate. py", line 230, in testBug246983 develop/ sandboxes/ Zope/Zope/ lib/python/ Shared/ DC/Scripts/ Bindings. py", line 321, in __call__ ec(args, kw, None) develop/ sandboxes/ Zope/Zope/ lib/python/ Shared/ DC/Scripts/ Bindings. py", line 358, in _bindAndExec bound_data, args, kw) develop/ sandboxes/ Zope/Zope/ lib/python/ Products/ PageTemplates/ ZopePageTemplat e.py", line 330, in _exec render( extra_context= bound_names) develop/ sandboxes/ Zope/Zope/ lib/python/ Products/ PageTemplates/ ZopePageTemplat e.py", line 427, in pt_render pt_render( self, source, extra_context) develop/ sandboxes/ Zope/Zope/ lib/python/ Products/ PageTemplates/ PageTemplate. py", line 78, in pt_render showtal) develop/ sandboxes/ Zope/Zope/ lib/python/ zope/pagetempla te/pagetemplate .py", line 115, in pt_render ns=sourceAnnota tions)( ) develop/ sandboxes/ Zope/Zope/ lib/python/ zope/tal/ talinterpreter. py", line 271, in __call__ interpret( self.program) develop/ sandboxes/ Zope/Zope/ lib/python/ zope/tal/ talinterpreter. py", line 346, in interpret opcode] (self, args) develop/ sandboxes/ Zope/Zope/ lib/python/ zope/tal/ talinterpreter. py", line 623, in do_insertText_tal evaluateText( stuff[0] ) develop/ sandboxes/ Zope/Zope/ lib/python/ Products/ PageTemplates/ Expressions. py", line 196, in evaluateText develop/ sandboxes/ Zope/Zope/ lib/python/ zope/tales/ tales.py" , line 696, in evaluate develop/ sandboxes/ Zope/Zope/ lib/python/ zope/tales/ expressions. py", line 263, in __call__
testMethod()
File "/home/
zpt()
File "/home/
return self._bindAndEx
File "/home/
return self._exec(
File "/home/
result = self.pt_
File "/home/
result = PageTemplate.
File "/home/
showtal=
File "/home/
strictinsert=0, sourceAnnotatio
File "/home/
self.
File "/home/
handlers[
File "/home/
text = self.engine.
File "/home/
text = self.evaluate(expr)
File "/home/
return expression(self)
File "/home/
return self._expr % tuple(vvals)