Hi!
Sorry for quick (RTFM type) mail, I found it:
environment.py:
...
config['pylons.app_globals'].mako_lookup = TemplateLookup(
directories=paths['templates'],
error_handler=handle_mako_error,
module_directory=os.path.join(app_conf['cache_dir'],
'templates'),
input_encoding='utf-8', default_filters=['unicodifyfilter',
'escape'],
imports=['from graffity.lib.dwunicodify import
unicodifyfilter', 'from webhelpers.html import escape' ]
)
...
unicodifyfilter proc is:
def unicodifyfilter(obj):
if obj == None:
return u''
if type(obj) == type(u''):
return obj
if type(obj) != type(''):
obj = str(obj)
obj = obj.decode('iso-8859-2', 'replace')
return obj
Very good!!!
dd
On máj. 25, 09:46, durumdara <[email protected]> wrote:
> Hi!
>
> We have iso-8859-2 charset in this country I living.
>
> I used Cheetah, mod_psp, and other template systems before mako, and
> these systems are not need unicode input.
>
> We have some special chars ("áéíúüűóöő"), and some others that cannot
> handle by simple str().
>
> Because I have variable inputs, possible it is a record-set, or a
> dict, or other, now I need to convert each of them in rendering by my
> method...
> ${c.tounicode(d['aaa'])}
>
> It is hard and I have many time to miss this pre-tag... Then I
> possible got pylons/mako error - if I used/got some of these chars...
>
> I searching for a solution that can convert the rendered params with
> it's unicode version in the background, without many typing...
>
> In mako's discuss they said that I need my own filter to do this.
>
> http://groups.google.com/group/mako-discuss/browse_thread/thread/1756...
>
> This would be good, but I don't know, how to call default mako
> renderer with this filtering method.
>
> I don't know, it is possible or not, and if possible, how.
>
> If not, I need to make my own render procedure - I think...
>
> GURUS - please help me!
>
> Thanks for it:
> dd
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---