#743: kid default utf-8 support is incomplete
-----------------------------+----------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone:
Component: CherryPy | Version: 0.9a4
Severity: normal | Keywords:
-----------------------------+----------------------------------------------
A traceback occurs if you pass non-ascii characters to kid because the
templates' assume_encoding defaults to ascii and there is no way to
override.
I will attach a patch to fix this issue. I hope it can make it in before
0.9.
The following is the traceback that I get:
{{{
Traceback (most recent call last):
File
"/home/jtate/devel/turbogears/thirdparty/cherrypy/cherrypy/_cphttptools.py",
line 106, in _run
self.main()
File
"/home/jtate/devel/turbogears/thirdparty/cherrypy/cherrypy/_cphttptools.py",
line 255, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in index
File "/home/jtate/devel/turbogears/turbogears/controllers.py", line 206,
in expose
output = database.run_with_transaction(expose._expose,func, accept,
allow_json, allow_json_from_config,*args, **kw)
File "/home/jtate/devel/turbogears/turbogears/database.py", line 216, in
run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/home/jtate/devel/turbogears/turbogears/controllers.py", line 227,
in <lambda>
expose._expose.when(rule)(lambda _func, accept, allow_json,
allow_json_from_config,*args,**kw: _execute_func(
File "/home/jtate/devel/turbogears/turbogears/controllers.py", line 258,
in _execute_func
return _process_output(output, template, format, content_type,
mapping, fragment)
File "/home/jtate/devel/turbogears/turbogears/controllers.py", line 56,
in _process_output
mapping=mapping, content_type=content_type,fragment=fragment)
File "/home/jtate/devel/turbogears/turbogears/view/base.py", line 131,
in render
return engine.render(**kw)
File "/home/jtate/devel/turbogears/plugins/kid/turbokid/kidsupport.py",
line 157, in render
return t.serialize(encoding=self.defaultencoding, output=format,
fragment=fragment)
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/__init__.py", line
236, in serialize
return serializer.serialize(self, encoding, fragment)
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/serialization.py",
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/serialization.py",
line 327, in generate
for ev, item in self.apply_filters(stream):
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/serialization.py",
line 84, in balancing_filter
for ev, item in stream:
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/pull.py", line
206, in _coalesce
for ev, item in stream:
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/filter.py", line
21, in transform_filter
for ev, item in apply_matches(stream, template, templates,
apply_func):
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/filter.py", line
31, in apply_matches
item = stream.expand()
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/pull.py", line 95,
in expand
for ev, item in self._iter:
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/pull.py", line
164, in _track
for p in stream:
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/pull.py", line
206, in _coalesce
for ev, item in stream:
File "/home/jtate/test/tg/foo2/foo2/templates/index.py", line 104, in
_pull
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/template_util.py",
line 60, in make_attrib
ls = [to_unicode(i, encoding) for i in v if i is not None]
File "/home/jtate/devel/turbogears/thirdparty/kid/kid/pull.py", line
190, in to_unicode
return unicode(value, encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0:
ordinal not in range(128)
}}}
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/743>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---