This occurs because werkzeug.utils.escape() auto-casts
non-basestring values to unicode, while we expect to be
working with bytestrings only.
So when evaluating attribute values, make sure we always
return bytestring values, never int, bool or unicode.
att, val = attribute_name[7:], self.eval_format(attribute_value, qwebcontext)
elif attribute_name.startswith("t-att-"):
att, val = attribute_name[6:], self.eval(attribute_value, qwebcontext)
- if isinstance(val, unicode):
- val = val.encode("utf8")
else:
att, val = self.eval_object(attribute_value, qwebcontext)
+ if val and not isinstance(val, str):
+ val = unicode(val).encode("utf8")
return att, val
# Tags