diff options
author | Dafydd Harries <daf@rhydd.org> | 2013-03-18 18:53:42 -0400 |
---|---|---|
committer | Dafydd Harries <daf@rhydd.org> | 2013-03-18 18:53:42 -0400 |
commit | 800dfb6c174473e11f65a6fc7d4cdfea2f41f2f1 (patch) | |
tree | 4e38f3aac44cc0a45b519e28fb018aae6ca39aad | |
parent | acb3a32e1bcc06031ff5e073e950e98a4b775e40 (diff) |
avoid unicode/str mixing errors in templates
-rw-r--r-- | export.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -51,7 +51,9 @@ class Template(object): def __str__(self): return '{{%s\n%s\n}}' % ( self.name, - '\n'.join(['|' + '%s=%s' % (n, v) for (n, v) in self.values])) + '\n'.join(['|' + '%s=%s' % + (n, v.encode('utf8') if isinstance(v, unicode) else v) + for (n, v) in self.values])) def parse_tags(s): return s.replace('\n', '').split(', ') |