template.py does not understand unicode literals

Bug #120644 reported by Anand Chitipothu
2
Affects Status Importance Assigned to Milestone
web.py
Fix Released
Undecided
Anand Chitipothu

Bug Description

The following test fails because template.py does not understand unicode literals.

        lambda: t(u'$def with (f)\n$f("x")')(lambda x:x), 'x\n',

And here is the fix.

     def h_literal(self, i):
         item = i[THING]
- if isinstance(item, str) and item[0] in ['"', "'"]:
+ if isinstance(item, (str, unicode)) and item[0] in ['"', "'"]:
             item = item[1:-1]
         elif isinstance(item, (float, int)):
             pass

Revision history for this message
Adam Atlas (adam-atlas) wrote :

Actually, instead of `(str, unicode)`, you can just use `basestring`. That's what it's for.

And it might be a few milliseconds faster. :)

Changed in webpy:
status: New → Fix Committed
Changed in webpy:
assignee: nobody → anandology
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.