From 4ffb2c8c2095d364fcbf8893bca3421509dd13f8 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 23 Feb 2015 17:32:55 +0100 Subject: [PATCH] Fix tests --- gns3server/handlers/upload_handler.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gns3server/handlers/upload_handler.py b/gns3server/handlers/upload_handler.py index 394450c8..de6809be 100644 --- a/gns3server/handlers/upload_handler.py +++ b/gns3server/handlers/upload_handler.py @@ -35,10 +35,13 @@ class UploadHandler: ) def index(request, response): files = [] - for filename in os.listdir(UploadHandler.image_directory()): - if os.path.isfile(os.path.join(UploadHandler.image_directory(), filename)): - if filename[0] != ".": - files.append(filename) + try: + for filename in os.listdir(UploadHandler.image_directory()): + if os.path.isfile(os.path.join(UploadHandler.image_directory(), filename)): + if filename[0] != ".": + files.append(filename) + except OSError as e: + pass response.template("upload.html", files=files, image_path=UploadHandler.image_directory()) @classmethod