Hi Walter.

Try the ways I think.

Write coding settings on first line of mako template.
# -*- coding:utf-8 -*-

Use unicode for values with twforms.

Take care.

aodag

2007/7/26, Walter Cruz <[EMAIL PROTECTED]>:
>
> Hi all..
> I and a friend have a project that we use to learn about Pylons.
>
> Today, I have tried to upgrade it to Pylons 0.96.
>
> Everything gets fine (I haven't upgraded to SAContext, but I will do that 
> ASAP).
>
> But, we use twforms, and a problem arises:
>
>
> The traceback:
>
> File 
> '/home/digo/devel/python/pylon_projects/ferlons/ferlons/controllers/usuario.py',
> line 32 in edit
>   return render_response('/usuario-edit.html')
> File 
> '/usr/lib/python2.5/site-packages/Pylons-0.9.6rc1-py2.5.egg/pylons/templating.py',
> line 357 in render_response
>   response.content = render(*args, **kargs)
> File 
> '/usr/lib/python2.5/site-packages/Pylons-0.9.6rc1-py2.5.egg/pylons/templating.py',
> line 338 in render
>   format=format, namespace=kargs, **cache_args)
> File 
> '/usr/lib/python2.5/site-packages/Pylons-0.9.6rc1-py2.5.egg/pylons/templating.py',
> line 225 in render
>   **options)
> File 
> '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/ext/turbogears.py',
> line 49 in render
>   return template.render(**info)
> File '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/template.py',
> line 114 in render
>   return runtime._render(self, self.callable_, args, data)
> File '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/runtime.py',
> line 287 in _render
>   _render_context(template, callable_, context, *args,
> **_kwargs_for_callable(callable_, data))
> File '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/runtime.py',
> line 304 in _render_context
>   _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
> File '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/runtime.py',
> line 337 in _exec_template
>   callable_(context, *args, **kwargs)
> File 
> '/home/digo/devel/python/pylon_projects/ferlons/data/templates/base.html.py',
> line 28 in render_body
>   context.write(filters.decode.utf8(next.body()))
> File '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/runtime.py',
> line 193 in <lambda>
>   return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
> File 
> '/home/digo/devel/python/pylon_projects/ferlons/data/templates/usuario-edit.html.py',
> line 31 in render_body
>   
> context.write(filters.decode.utf8(c.form.display(c.usuario,action=u'../save/'
> + unicode(c.usuario.id))))
> File '/usr/lib/python2.5/site-packages/Mako-0.1.8-py2.5.egg/mako/filters.py',
> line 48 in decode
>   return str(x)
> File '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/core.py',
> line 192 in __str__
> File '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/core.py',
> line 154 in render
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/output.py',
> line 45 in encode
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/output.py',
> line 176 in __call__
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/output.py',
> line 519 in __call__
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/output.py',
> line 679 in __call__
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/output.py',
> line 459 in __call__
> File '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/core.py',
> line 212 in _ensure
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/markup.py',
> line 246 in _include
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/markup.py',
> line 291 in _match
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/markup.py',
> line 236 in _exec
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/base.py',
> line 432 in _eval
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/base.py',
> line 398 in _eval
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/base.py',
> line 442 in _flatten
> File '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/core.py',
> line 212 in _ensure
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/markup.py',
> line 246 in _include
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/markup.py',
> line 291 in _match
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/markup.py',
> line 236 in _exec
> File 
> '/usr/lib/python2.5/site-packages/Genshi-0.4.3-py2.5.egg/genshi/template/base.py',
> line 417 in _eval
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 2: ordinal not in range(128)
>
> Acording to that entries on tracs
> (http://www.makotemplates.org/trac/ticket/35 and
> trac.turbogears.org/ticket/1329) the problem is fixed. I've put:
>
>     tmpl_options['mako.input_encoding'] = 'utf-8'
>     tmpl_options['mako.output_encoding'] = 'utf-8'
>
> in my environment.py
>
> Everything works, except by this twForm.
>
> Can someone help me?
>
> []'s
> - Walter
>
> >
>


-- 
/*
Atsushi Odagiri
http://d.hatena.ne.jp/aodag/
http://aodag.tumblr.com
mailto:[EMAIL PROTECTED]
*/

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