use to_dict() here, so we can use |json in jscript

This commit is contained in:
2025-10-04 22:45:28 +10:00
parent 7a4f5ddb17
commit 81ebf6fa01

View File

@@ -63,6 +63,9 @@ class PathDetail(PA):
# construct icon_url based on type of storage path (icons.svg contains icons for each)
self.icon_url:str=url_for("internal", filename="icons.svg") + "#" + ICON[self.type]
def to_dict(self):
return {key: value for key, value in vars(self).items()}
################################################################################
# helper function to find path details for move destinations - used in html
# for move DBox to show potential storage paths to move files into
@@ -83,9 +86,9 @@ def MovePathDetails():
sps=Path.query.join(PathType).filter(PathType.name=="Storage").all()
for p in sps:
obj = PathDetail( ptype="Storage", path=p.path_prefix.replace("static/Storage/","") )
ret.append( obj )
ret.append( obj.to_dict() )
ips=Path.query.join(PathType).filter(PathType.name=="Import").all()
for p in ips:
obj = PathDetail( ptype="Import", path=p.path_prefix.replace("static/Import/","") )
ret.append( obj )
ret.append( obj.to_dict() )
return ret