From 90a7766de81a247d9320d9c9cdcc8b8654294dbc Mon Sep 17 00:00:00 2001 From: David Garcia Date: Wed, 20 May 2020 12:09:37 +0200 Subject: [PATCH] Fix bug 1069: Add default value for fsmongo.GridByteStream.file_type Change-Id: Icf2b6c76a77526f118facd2053bd8dac33730415 Signed-off-by: David Garcia --- osm_common/fsmongo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osm_common/fsmongo.py b/osm_common/fsmongo.py index cd7f7f0..3c68a5f 100644 --- a/osm_common/fsmongo.py +++ b/osm_common/fsmongo.py @@ -35,6 +35,7 @@ class GridByteStream(BytesIO): self.filename = filename self.fs = fs self.mode = mode + self.file_type = "file" # Set "file" as default file_type self.__initialize__() @@ -110,6 +111,7 @@ class GridStringStream(StringIO): self.filename = filename self.fs = fs self.mode = mode + self.file_type = "file" # Set "file" as default file_type self.__initialize__() @@ -200,7 +202,7 @@ class FsMongo(FsBase): for directory in dir_cursor: os.makedirs(self.path + directory.filename, exist_ok=True) - file_cursor = self.fs.find({"metadata.type": {"$elemMatch": ["file", "sym"]}}, no_cursor_timeout=True) + file_cursor = self.fs.find({"metadata.type": {"$in": ["file", "sym"]}}, no_cursor_timeout=True) for writing_file in file_cursor: file_path = self.path + writing_file.filename @@ -210,7 +212,7 @@ class FsMongo(FsBase): if "permissions" in writing_file.metadata: if writing_file.metadata["type"] == "sym": os.chmod( - file_path, + file_path, writing_file.metadata["permissions"] | stat.S_IFLNK ) else: -- 2.25.1