Skip to content

Update api_resource.py #43

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions codepost/models/abstract/api_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ def instance_endpoint_by_id(self, id=None):
except IndexError: # means formatting didn't work
pass

# This is NOT the proper fix; I'm only making this change to get
# scripts working after the breaking change made to the API and to
# this code. I have no idea if this is the only "weird" case or not
# but the API requires a trailing / when *updating* submissions.
# At least this change doesn't seem to affect the other REST actions
# (GET at least; didn't bother testing others)
if self.class_endpoint == "/submissions/":
return urljoin(self.class_endpoint, "{}/".format(_id))

# CASE 2: The class end point has not formatting parameter
return urljoin(self.class_endpoint, "{}".format(_id))

Expand Down