Commit c693af08 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix path param name.

parent 58089c38
Pipeline #26221 passed with stages
in 1 minute and 42 seconds
...@@ -101,8 +101,8 @@ def create_app(test_config=None): ...@@ -101,8 +101,8 @@ def create_app(test_config=None):
# api.add_resource(JobReport, '/v1/job/<topic_name>/report') # api.add_resource(JobReport, '/v1/job/<topic_name>/report')
api.add_resource(WriteJobResultToDrupal, '/v1/drupal/<job_drupal_uuid>/<job_log_drupal_uuid>') api.add_resource(WriteJobResultToDrupal, '/v1/drupal/<job_drupal_uuid>/<job_log_drupal_uuid>')
api.add_resource(WriteTypeReportToDrupal, '/v1/drupal/WriteElementReport') api.add_resource(WriteTypeReportToDrupal, '/v1/drupal/WriteElementReport')
api.add_resource(UpdateInstitution, '/v1/drupal/institution/<institutionId>') api.add_resource(UpdateInstitution, '/v1/drupal/institution/<institution_drupal_uuid>')
api.add_resource(UpdateRecordSet, '/v1/drupal/recordset/<record_set_id>') api.add_resource(UpdateRecordSet, '/v1/drupal/recordset/<record_set_drupal_uuid>')
api.add_resource( api.add_resource(
DeleteRecord, DeleteRecord,
'/v1/drupal/delete/record/<session_id>', '/v1/drupal/delete/record/<session_id>',
......
...@@ -17,7 +17,7 @@ class UpdateRecordSet(Resource): ...@@ -17,7 +17,7 @@ class UpdateRecordSet(Resource):
value_serializer=lambda m: json.dumps(m, ensure_ascii=False) value_serializer=lambda m: json.dumps(m, ensure_ascii=False)
.encode('utf-8')) .encode('utf-8'))
def get(self, record_set_id): def get(self, record_set_drupal_uuid):
""" """
Update the record set with the given drupal UUID in the backend. Update the record set with the given drupal UUID in the backend.
--- ---
...@@ -25,7 +25,7 @@ class UpdateRecordSet(Resource): ...@@ -25,7 +25,7 @@ class UpdateRecordSet(Resource):
- Import Record Set - Import Record Set
parameters: parameters:
- in: path - in: path
name: record_set_id name: record_set_drupal_uuid
required: true required: true
description: The UUID of the updated recordset description: The UUID of the updated recordset
example: 0c4c777c-94f8-45ba-945a-bfe6967d40da example: 0c4c777c-94f8-45ba-945a-bfe6967d40da
...@@ -56,9 +56,9 @@ class UpdateRecordSet(Resource): ...@@ -56,9 +56,9 @@ class UpdateRecordSet(Resource):
# Retrieve Drupal Entities for each language. # Retrieve Drupal Entities for each language.
# Returns default entity if there is a language missing. # Returns default entity if there is a language missing.
de_drupal_url = f'{base_url}/de{json_api_path}{record_set_id}' de_drupal_url = f'{base_url}/de{json_api_path}{record_set_drupal_uuid}'
fr_drupal_url = f'{base_url}/fr{json_api_path}{record_set_id}' fr_drupal_url = f'{base_url}/fr{json_api_path}{record_set_drupal_uuid}'
it_drupal_url = f'{base_url}/it{json_api_path}{record_set_id}' it_drupal_url = f'{base_url}/it{json_api_path}{record_set_drupal_uuid}'
try: try:
drupal_record_set_de = \ drupal_record_set_de = \
requests.get(de_drupal_url, headers=headers, auth=auth).json()['data'] requests.get(de_drupal_url, headers=headers, auth=auth).json()['data']
...@@ -199,7 +199,7 @@ class UpdateRecordSet(Resource): ...@@ -199,7 +199,7 @@ class UpdateRecordSet(Resource):
'field_teaser_image': drupal_record_set_de['relationships']['field_teaser_image'] 'field_teaser_image': drupal_record_set_de['relationships']['field_teaser_image']
} }
except LookupError as ex: except LookupError as ex:
msg = 'LookupError for ' + record_set_id + ': ' + str(ex) + '\n' + \ msg = 'LookupError for ' + record_set_drupal_uuid + ': ' + str(ex) + '\n' + \
traceback.format_exc() + '\n' + \ traceback.format_exc() + '\n' + \
'baseRequest: ' + de_drupal_url + '\n' 'baseRequest: ' + de_drupal_url + '\n'
current_app.logger.error(msg) current_app.logger.error(msg)
...@@ -209,7 +209,7 @@ class UpdateRecordSet(Resource): ...@@ -209,7 +209,7 @@ class UpdateRecordSet(Resource):
'result_topic_value': result_topic_value 'result_topic_value': result_topic_value
}, 500 }, 500
except Exception as ex: except Exception as ex:
msg = 'Exception for ' + record_set_id + ': ' + str(ex) + '\n' + \ msg = 'Exception for ' + record_set_drupal_uuid + ': ' + str(ex) + '\n' + \
traceback.format_exc() + '\n' + \ traceback.format_exc() + '\n' + \
'baseRequest: ' + de_drupal_url + '\n' 'baseRequest: ' + de_drupal_url + '\n'
current_app.logger.error(msg) current_app.logger.error(msg)
...@@ -219,7 +219,7 @@ class UpdateRecordSet(Resource): ...@@ -219,7 +219,7 @@ class UpdateRecordSet(Resource):
'result_topic_value': result_topic_value, 'result_topic_value': result_topic_value,
}, 500 }, 500
return self.send_message(result_topic_value, record_set_id) return self.send_message(result_topic_value, record_set_drupal_uuid)
def send_message(self, result_topic_value, record_set_drupal_id): def send_message(self, result_topic_value, record_set_drupal_id):
headers = [ headers = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment