Skip to content

Commit

Permalink
Changed literal_eval to json.loads
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Apr 5, 2021
1 parent 648a34b commit 8b1d447
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions panel/pane/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""
import json
import textwrap
from ast import literal_eval

from six import string_types

Expand Down Expand Up @@ -340,7 +339,7 @@ def applies(cls, obj, **params):
def _get_properties(self):
properties = super()._get_properties()
try:
data = literal_eval(self.object)
data = json.loads(self.object)
except Exception:
data = self.object
text = json.dumps(data or {}, cls=self.encoder)
Expand Down
2 changes: 1 addition & 1 deletion panel/tests/pane/test_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def test_json_pane(document, comm):
assert model.text == '{"a": 2}'
assert pane._models[model.ref['id']][0] is model

pane.object = "{'b': 3}"
pane.object = '{"b": 3}'
assert model.text == '{"b": 3}'
assert pane._models[model.ref['id']][0] is model

Expand Down

0 comments on commit 8b1d447

Please sign in to comment.