template.py fails with unicode

Bug #180510 reported by Anand Chitipothu on 2008-01-05
2
Affects Status Importance Assigned to Milestone
web.py
High
Anand Chitipothu

Bug Description

Template.py fails when the template string is UTF.

test 1:
   t(u'$def with ()\nfoo")')() == 'foo\n'

   Traceback (most recent call last):
  File "template.py", line 881, in <module>
    test()
  File "template.py", line 869, in test
    t(u'$def with ()\nfoo")')() == 'foo\n'
  File "template.py", line 817, in __call__
    return TestResult(self.text, Template(self.text)(*a, **kw))
  File "template.py", line 498, in __call__
    return f.go()
  File "template.py", line 760, in go
    self.output._str = ''.join(map(self.h, self.parsetree))
  File "template.py", line 552, in h
    return getattr(self, 'h_' + item[WHAT])(item)
  File "template.py", line 691, in h_line
    raise WTF, x
__main__.WTF: foo")

test2:

    def f(x): return x
    t(u'$def with (f)\n$:f(x="x")')(f) == 'x\n'

Traceback (most recent call last):
  File "template.py", line 881, in <module>
    test()
  File "template.py", line 872, in test
    t(u'$def with (f)\n$:f(x="x")')(f) == 'x\n'
  File "template.py", line 817, in __call__
    return TestResult(self.text, Template(self.text)(*a, **kw))
  File "template.py", line 498, in __call__
    return f.go()
  File "template.py", line 760, in go
    self.output._str = ''.join(map(self.h, self.parsetree))
  File "template.py", line 552, in h
    return getattr(self, 'h_' + item[WHAT])(item)
  File "template.py", line 684, in h_line
    o = self.h(x[NAME])
  File "template.py", line 552, in h
    return getattr(self, 'h_' + item[WHAT])(item)
  File "template.py", line 611, in h_call
    return call(*args, **kw)
TypeError: f() keywords must be strings

Changed in webpy:
assignee: nobody → anandology
importance: Undecided → High
milestone: none → 0.23
status: New → Confirmed
Changed in webpy:
status: Confirmed → Fix Committed
Changed in webpy:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers