Skip to content

Commit

Permalink
Rename filename to identifier.
Browse files Browse the repository at this point in the history
  • Loading branch information
Delsinvg committed Jan 5, 2024
1 parent ca03af5 commit 1ac85cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/elody/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __create_mediafile(self, entity_id, mediafile):
return self.__handle_response(response, "Failed to create mediafile", "text")

def __get_upload_location(
self, entity_id, filename, is_public=True, identifiers=None
self, entity_id, identifier, is_public=True, identifiers=None
):
if not identifiers:
identifiers = list()
Expand All @@ -32,7 +32,7 @@ def __get_upload_location(
}
]
mediafile = {
"filename": filename,
"identifier": identifier,
"metadata": metadata,
"identifiers": identifiers,
}
Expand Down Expand Up @@ -104,11 +104,11 @@ def update_object_relations(self, collection, identifier, payload):
response = requests.patch(url, json=payload, headers=self.headers)
return self.__handle_response(response, "Failed to update object relations")

def upload_file_from_url(self, entity_id, filename, file_url, identifiers=None):
def upload_file_from_url(self, entity_id, identifier, file_url, identifiers=None):
if not identifiers:
identifiers = list()
upload_location = self.__get_upload_location(
entity_id, filename, True, identifiers
entity_id, identifier, True, identifiers
)
print(upload_location)
mediafile = requests.get(file_url).content
Expand Down
2 changes: 1 addition & 1 deletion src/elody/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from elody.schemas import entity_schema, mediafile_schema

class CSVParser:
top_level_fields = ["type", "filename"]
top_level_fields = ["type", "identifier"]
identifier_fields = ["identifiers", "identifier", "object_id", "entity_id"]
schema_mapping = {
"entity": entity_schema,
Expand Down
4 changes: 2 additions & 2 deletions src/elody/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class DuplicateFileException(Exception):
def __init__(self, message, filename=None, md5sum=None):
def __init__(self, message, identifier=None, md5sum=None):
super().__init__(message)
self.message = message
self.filename = filename
self.filename = identifier
self.md5sum = md5sum


Expand Down
6 changes: 3 additions & 3 deletions src/elody/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@
"type": "object",
"default": {},
"required": [
"filename",
"identifier",
],
"properties": {
"filename": {
"identifier": {
"type": "string",
},
"original_file_location": {
Expand Down Expand Up @@ -170,4 +170,4 @@
},
},
"additionalProperties": True,
}
}

0 comments on commit 1ac85cb

Please sign in to comment.