Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 9 by
mas...@google.com: Small patch + tests to fix Unicode support
http://code.google.com/p/ezt/issues/detail?id=9
Currently EZT gets confused when the input is unicode, e.g. in Python 2.6:
>>> import ezt, sys, StringIO
>>> template = ezt.Template()
>>> template.parse(u'♥')
>>> f = StringIO.StringIO()
>>> template.generate(f, {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ezt.py", line 137, in generate
self._execute(self.program, fp, ctx)
File "ezt.py", line 296, in _execute
method, method_args, filename, line_number = step
ValueError: need more than 1 value to unpack
I've attached below a patch with a small fix to ezt.py and new tests in
tests/ezt_test.py.
Note that I switched from cStringIO to StringIO because cStringIO doesn't
support unicode. This will make templates with [define ...] directives (and
only them) slightly slower, but it's an acceptable tradeoff IMHO.
The patch should not introduce any backward incompatibilities since unicode
templates were previously not supported.
P.S.: on a personal note, Daniel Berlin says "hi" to Greg Stein. I guess
you guys know each other. :-)
Attachments:
ezt_unicode-1.diff 5.1 KB