Skip to content

Commit

Permalink
- make sure all JSON-serialized data is text data and not bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Apr 26, 2019
1 parent 6e2c0ea commit a0b0627
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,9 @@ Changelog
3.0b8 (unreleased)
------------------

- make sure all JSON-serialized data is text data and not bytes
(`#45 <https://github.com/zopefoundation/DocumentTemplate/issues/45>`_)


3.0b7 (2019-04-25)
------------------
Expand Down
6 changes: 5 additions & 1 deletion src/TreeDisplay/TreeTag.py
Expand Up @@ -256,6 +256,7 @@ def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data,
try_call_attr=try_call_attr, encoding=None,
):
"Render a tree as a table"
encoding = encoding or 'latin-1'
exp = 0

if level >= 0:
Expand Down Expand Up @@ -340,7 +341,10 @@ def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data,
items = list(items) # Copy the list
items.reverse()

diff.append(id)
if isinstance(id, six.binary_type):
diff.append(id.decode(encoding))
else:
diff.append(id)

_td_colspan = '<td colspan="%s" style="white-space: nowrap"></td>'
_td_single = '<td width="16" style="white-space: nowrap"></td>'
Expand Down

0 comments on commit a0b0627

Please sign in to comment.