From: David Garcia Date: Wed, 20 May 2020 10:09:37 +0000 (+0200) Subject: Fix bug 1069: Add default value for fsmongo.GridByteStream.file_type X-Git-Tag: v7.1.0rc3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=ac820b8e14eb0dc74b300a10a7c8951bf9c35728;p=osm%2Fcommon.git Fix bug 1069: Add default value for fsmongo.GridByteStream.file_type Change-Id: Icf2b6c76a77526f118facd2053bd8dac33730415 Signed-off-by: David Garcia --- 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: