deal with empty data dir
This commit is contained in:
@@ -92,7 +92,7 @@ def get_current_image(images):
|
|||||||
|
|
||||||
|
|
||||||
def get_image_list():
|
def get_image_list():
|
||||||
return sorted(
|
image_list = sorted(
|
||||||
[
|
[
|
||||||
os.path.join(app.config["IMAGEDIR"], x)
|
os.path.join(app.config["IMAGEDIR"], x)
|
||||||
for x in os.listdir(app.config["IMAGEDIR"])
|
for x in os.listdir(app.config["IMAGEDIR"])
|
||||||
@@ -100,6 +100,9 @@ def get_image_list():
|
|||||||
],
|
],
|
||||||
key=natural_key,
|
key=natural_key,
|
||||||
)
|
)
|
||||||
|
if len(image_list) == 0:
|
||||||
|
return [None]
|
||||||
|
return image_list
|
||||||
|
|
||||||
|
|
||||||
def get_metadata(imagepath):
|
def get_metadata(imagepath):
|
||||||
@@ -211,4 +214,4 @@ def show_image(id=None):
|
|||||||
labels=labels,
|
labels=labels,
|
||||||
id_minus=id_minus,
|
id_minus=id_minus,
|
||||||
id_plus=id_plus,
|
id_plus=id_plus,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user