On Apr 14, 2007, at 11:55 PM, Max Ischenko wrote:

>
> Hi,
>
> On Apr 15, 12:30 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
>>> 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.
>
> Sorry for not providing every detail up-front. The problem was caused
> by a syntax error which caused Mako to fail when it tried to report
> it.
>
> Here is a minimal test case:
>
> ----- offending file -----
> # -*- coding: utf-8 -*-
>
> % if 2 == 2: # an innocently-looking comment
> ${u'привет'}
> % endif
> ----------------------------------
>
> If you replace unicode string with something ascii-safe you do get a
> proper error from mako (CompileException).

Ah, ok. We had to fix this for Myghty 1.1, I've logged a ticket with  
a patch to half-fix this:

http://www.makotemplates.org/trac/ticket/37

Mike, is there any reason why Templates don't have an  
'encoding_errors' var to go along with 'output_encoding'? See that  
ticket for why it might be nice to have

--
Philip Jenvey



--~--~---------~--~----~------------~-------~--~----~
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