Renamed capture.filename to capture.name

This commit is contained in:
Joel Collins 2020-01-29 16:21:38 +00:00
parent 64eb87bf6f
commit e9e2419fe4
2 changed files with 9 additions and 9 deletions

View file

@ -20,7 +20,7 @@ class CaptureSchema(Schema):
data_key="path", description="Path of file on microscope device" data_key="path", description="Path of file on microscope device"
) )
exists = fields.Bool(data_key="available") exists = fields.Bool(data_key="available")
filename = fields.String() name = fields.String()
metadata = fields.Dict() metadata = fields.Dict()
links = fields.Dict() links = fields.Dict()
@ -50,7 +50,7 @@ class CaptureSchema(Schema):
"href": url_for( "href": url_for(
CaptureDownload.endpoint, CaptureDownload.endpoint,
id=data.id, id=data.id,
filename=data.filename, filename=data.name,
_external=True, _external=True,
), ),
"mimetype": "image/jpeg", "mimetype": "image/jpeg",

View file

@ -152,11 +152,11 @@ class CaptureObject(object):
Args: Args:
filepath (str): String of the full file path, including file format extension filepath (str): String of the full file path, including file format extension
""" """
# Split the full file path into a folder and a filename # Split the full file path into a folder and a name
self.filefolder, self.filename = os.path.split(filepath) self.filefolder, self.name = os.path.split(filepath)
# Split the filename out from it's file extension # Split the name out from it's file extension
self.basename = os.path.splitext(self.filename)[0] self.basename = os.path.splitext(self.name)[0]
self.format = self.filename.split(".")[-1] self.format = self.name.split(".")[-1]
@property @property
def exists(self) -> bool: def exists(self) -> bool:
@ -243,7 +243,7 @@ class CaptureObject(object):
d = { d = {
"image": { "image": {
"id": self.id, "id": self.id,
"name": self.filename, "name": self.name,
"acquisitionDate": self.datetime.isoformat(), "acquisitionDate": self.datetime.isoformat(),
"format": self.format, "format": self.format,
"tags": self.tags, "tags": self.tags,
@ -262,7 +262,7 @@ class CaptureObject(object):
""" """
# Create basic state dictionary # Create basic state dictionary
d = {"path": self.file, "filename": self.filename, "metadata": self.metadata} d = {"path": self.file, "name": self.name, "metadata": self.metadata}
# Combined availability of data # Combined availability of data
if self.exists: if self.exists: