Skip to content

Commit 47e503a

Browse files
committed
BCOs are not saving. Error Code 500.
Fix #370 Fix #369
1 parent eff850a commit 47e503a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

biocompute/apis.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ def post(self, request) -> Response:
102102
data = request.data
103103
rejected_requests = False
104104
accepted_requests = False
105-
105+
106106
if 'POST_api_objects_draft_create' in request.data:
107107
data = legacy_api_converter(request.data)
108108

109-
if data[0]["contents"]["object_id"]==BCO_000001_DRAFT["object_id"] and\
110-
request.data[0]["prefix"] == "TEST":
109+
test_id = data[0]["contents"].get("object_id", None)
110+
test_prefix = data[0].get("prefix", None)
111+
112+
if test_id==BCO_000001_DRAFT["object_id"] and test_prefix == "TEST":
111113
test_object_id = BCO_000001_DRAFT["object_id"]
112114
return Response(
113115
status=status.HTTP_200_OK,
@@ -321,6 +323,7 @@ def post(self, request) -> Response:
321323
continue
322324

323325
bco_results = validator.parse_and_validate(bco_instance.contents)
326+
import pdb; pdb.set_trace()
324327
identifier, results = bco_results.popitem()
325328

326329
if results["number_of_errors"] > 0:
@@ -560,6 +563,7 @@ def post(self, request):
560563
status_code = 400
561564
message = "BCO not valid"
562565
else:
566+
import pdb; pdb.set_trace()
563567
accepted_requests = True
564568
bco_status = "SUCCESS"
565569
status_code = 200
@@ -653,7 +657,6 @@ class PublishedRetrieveApi(APIView):
653657
Specifies the version of the BCO to be retrieved.
654658
"""
655659

656-
authentication_classes = [CustomJSONWebTokenAuthentication]
657660
permission_classes = [AllowAny]
658661

659662
@swagger_auto_schema(

0 commit comments

Comments
 (0)