On Apr 14, 2007, at 2:31 PM, Philip Jenvey wrote:

>
>
> On Apr 14, 2007, at 11:25 AM, Yury Yurevich wrote:
>
>> On 13:40:37 Sat 14 Apr    , Max Ischenko wrote:
>>> Hi,
>>>
>>> I have got a traceback in Pylons app. The strange thing is it is not
>>> displayed as other tracebacks in a pretty way, just ugly plain
>>> text http
>>> response. And the traceback itself gives little clue about what
>>> actually
>>> happened.
>>>
>>> I am using Pylons 0.9.5 + Mako.
>>>
>>>   File "/usr/lib/python2.4/site-packages/Mako-0.1.5-py2.4.egg/mako/
>>> runtime.py",
>>> line 303, in _render_context
>>>     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
>>>   File "/usr/lib/python2.4/site-packages/Mako-0.1.5-py2.4.egg/mako/
>>> runtime.py",
>>> line 336, in _exec_template
>>>     callable_(context, *args, **kwargs)
>>>   File "memory:-0x4ea1cd14", line 61, in render_body
>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in
>>> position 41:
>>> ordinal not in range(128)
>>>
>>
>> I've got such error instead of SyntaxException in non-ascii Mako
>> templates.
>>
>
> If you're including non-ascii text inside of a Mako template, make
> sure you specify a magic encoding comment at the top of the file:
>
> http://www.makotemplates.org/docs/ 
> documentation.html#unicode_specifying
>
> Like you would with a .py file.

magic encoding is necessary, but also the stack trace above is  
occuring within the render() step, so ensure that any expressions ${}  
etc. which include non-ascii characters evaluate to a unicode value.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to