On May 25, 2:05 am, durumdara <[email protected]> wrote:
> 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

def unicodifyfilter(obj):
    if obj is None:
        return u''
    elif isinstance(obj, unicode):
        return obj
    elif not isinstance(obj, str):
        obj = str(obj)
    obj = obj.decode('iso-8859-2', 'replace')
    return obj

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