Minor fixes for accessing fields

This commit is contained in:
Petr Kalis 2020-09-22 11:34:24 +02:00
parent 0ed04d2c5e
commit e3c8d9fd7c
2 changed files with 4 additions and 8 deletions

View file

@ -155,7 +155,6 @@ class GDriveHandler(AbstractProvider):
folder_id = self.folder_path_exists(path)
if folder_id:
return folder_id
parts = path.split('/')
folders_to_create = []
while parts:

View file

@ -292,9 +292,6 @@ class SyncServer():
file_id)
site_index, _ = self._get_provider_rec(file.get('sites', []),
provider_name)
log.debug("file_index {}, site_index {}".format(file_index,
site_index))
update = {}
if new_file_id:
update["$set"] = self._get_success_dict(file_index, site_index,
@ -358,7 +355,7 @@ class SyncServer():
OR (-1, None) if not present
"""
for index, rec in enumerate(files):
if rec._id == _id:
if rec.get("_id") == _id:
return index, rec
return -1, None
@ -377,7 +374,7 @@ class SyncServer():
OR (-1, None) if not present
"""
for index, rec in enumerate(sites):
if rec["name"] == provider:
if rec.get("name") == provider:
return index, rec
return -1, None
@ -467,8 +464,8 @@ class SyncServer():
Returns:
(int) - number of failed attempts
"""
return self._get_provider_rec(file.get("sites", []), provider).\
get("tries", 0)
_, rec = self._get_provider_rec(file.get("sites", []), provider)
return rec.get("tries", 0)
def _get_local_file_path(self, file, local_root):
"""