Skip to content

[SYNPY-1547] parentWikiId="" Bug #1165

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

Merged
merged 6 commits into from
Feb 13, 2025
Merged

Conversation

BWMac
Copy link
Contributor

@BWMac BWMac commented Feb 12, 2025

Description:

A user reported an unhandled error when trying to store a Wiki object in Synapse like so (where syn123 is instead a valid Synapse project ID that the user has access to):

from synapseclient import Wiki
import synapseclient

foo = Wiki(owner="syn123", title="test", parentWikiId="")
syn.store(foo)

This happened because the API does not treat that value of parentWikiId like a None value and instead throws an error. To prevent that error from happening, I added logic in Wiki.__init__ that converts any falsey value that is provided for parentWikiId to None.

Additionally, the user was receiving this error message:

AttributeError: 'SynapseHTTPError' object has no attribute 'message'

rather than a message passed on from the API which I addressed by updating logic here to check the response text.

Testing:
After these changes were made, the script above was able to be run successfully. I also added a unit test to ensure that parentWikiId="" is treated like parentWikiId=None and an integration test to ensure that Wiki objects created with parentWikiId="" are stored successfully in Synapse.

@BWMac BWMac marked this pull request as ready for review February 12, 2025 15:52
@BWMac BWMac requested a review from a team as a code owner February 12, 2025 15:52
Copy link
Member

@BryanFauble BryanFauble left a comment

Choose a reason for hiding this comment

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

Changes look good logically, just a few minor points

@BWMac BWMac merged commit 99c3d2f into develop Feb 13, 2025
24 of 25 checks passed
@BWMac BWMac deleted the bwmac/synpy-1547-wiki-parent-bug branch February 13, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants