Issue 9 in ezt: Small patch + tests to fix Unicode support

82 views
Skip to first unread message

e...@googlecode.com

unread,
Jul 17, 2012, 6:57:37 AM7/17/12
to ezt-d...@googlegroups.com
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

e...@googlecode.com

unread,
Aug 9, 2012, 3:51:33 PM8/9/12
to ezt-d...@googlegroups.com

Comment #1 on issue 9 by mas...@google.com: Small patch + tests to fix
Unicode support
http://code.google.com/p/ezt/issues/detail?id=9

Hi, any news on this?

Please let me know if there's anything that I can do to make fixing this
bug easier. E.g. updating the patch above or anything else, I'm willing to
spend time on this if it can help.

Thanks in advance and sorry for being a bit antsy. :-)

e...@googlecode.com

unread,
Jan 18, 2013, 2:25:59 PM1/18/13
to ezt-d...@googlegroups.com

Comment #2 on issue 9 by mas...@google.com: Small patch + tests to fix
Unicode support
http://code.google.com/p/ezt/issues/detail?id=9

Friendly ping. :-)

Could you guys please apply the patch attached to
http://code.google.com/p/ezt/issues/detail?id=9

e...@googlecode.com

unread,
Jan 18, 2013, 3:17:37 PM1/18/13
to ezt-d...@googlegroups.com
Updates:
Status: Fixed

Comment #3 on issue 9 by gstein: Small patch + tests to fix Unicode support
http://code.google.com/p/ezt/issues/detail?id=9

Pong.

Done (r38). Thanks!

Reply all
Reply to author
Forward
0 new messages