Skip to content

Commit

Permalink
fixed custom json encoders
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Chubatiuk authored and AndrewChubatiuk committed Feb 3, 2024
1 parent b98b5f2 commit 01cd16f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion redash/query_runner/cass.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def generate_ssl_options_dict(protocol, cert_path=None):
return ssl_options


def json_encoder(dec, o):
def custom_json_encoder(dec, o):
if isinstance(o, sortedset):
return list(o)
return None
Expand Down
2 changes: 1 addition & 1 deletion redash/query_runner/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}


def json_encoder(dec, o):
def custom_json_encoder(dec, o):
if isinstance(o, ObjectId):
return str(o)
elif isinstance(o, Timestamp):
Expand Down
2 changes: 1 addition & 1 deletion redash/query_runner/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}


def json_encoder(dec, o):
def custom_json_encoder(dec, o):
if isinstance(o, Range):
# From: https://github.com/psycopg/psycopg2/pull/779
if o._bounds is None:
Expand Down
2 changes: 1 addition & 1 deletion redash/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def generate_token(length):
return "".join(rand.choice(chars) for x in range(length))


json_encoders = [m.custom_json_encoder for m in sys.modules if hasattr(m, "custom_json_encoder")]
json_encoders = [m.custom_json_encoder for m in sys.modules.values() if hasattr(m, "custom_json_encoder")]


class JSONEncoder(json.JSONEncoder):
Expand Down

0 comments on commit 01cd16f

Please sign in to comment.