Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring PYTHON_LEGACY UUID representation in cfc_webapp.py #902

Merged
merged 2 commits into from
Mar 11, 2023

Conversation

swastis10
Copy link
Contributor

We cannot encode native uuid.UUID with UuidRepresentation.UNSPECIFIED therefore defining uuid_representation as PYTHON_LEGACY fixes the issue
Contains fix for - e-mission/e-mission-docs#856 (comment)

We cannot encode native uuid.UUID with UuidRepresentation.UNSPECIFIED therefore defining uuid_representation as PYTHON_LEGACY fixes the issue
Contains fix for - e-mission/e-mission-docs#856 (comment)
@swastis10
Copy link
Contributor Author

The test data is now being loaded fine by the local server on the UI.
Screen Shot 2023-03-10 at 7 48 07 PM

@shankari
Copy link
Contributor

@swastis10 I don't think we should edit bottle.py directly since it is a dependency and not our code
I would use the approach outlined in bottlepy/bottle#287

Note that I already do this in cfc_webapp.py, similar to the suggestions in the issue above

    for plugin in app.plugins:
        if isinstance(plugin, JSONPlugin):
            print("Replaced json_dumps in plugin with the one from bson")
            plugin.json_dumps = bson.json_util.dumps

You just need to change it to plugin.json_dumps = lambda s: bju.dumps(...)

@swastis10 swastis10 changed the title Configuring PYTHON_LEGACY UUID representation in bottle.py Configuring PYTHON_LEGACY UUID representation in cfc_webapp.py Mar 11, 2023
We cannot encode native uuid.UUID with UuidRepresentation.UNSPECIFIED therefore defining uuid_representation as PYTHON_LEGACY fixes the issue.

Contains fix for - e-mission/e-mission-docs#856 (comment)
@swastis10
Copy link
Contributor Author

The data is still loading fine, just like the screenshot attached above.

Copy link
Contributor

@shankari shankari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Will merge and deploy after the tests finish running

@shankari shankari merged commit 1a37427 into e-mission:master Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants