duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #04626
[Merge] lp:~crosser/duplicity/dpbx-fix-file-listing into lp:duplicity
Eugene Crosser has proposed merging lp:~crosser/duplicity/dpbx-fix-file-listing into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
For more details, see:
https://code.launchpad.net/~crosser/duplicity/dpbx-fix-file-listing/+merge/334277
Included the code suggested by Kenneth to narrow down the exception that should be ignored.
--
Your team duplicity-team is requested to review the proposed merge of lp:~crosser/duplicity/dpbx-fix-file-listing into lp:duplicity.
=== modified file 'duplicity/backends/dpbxbackend.py'
--- duplicity/backends/dpbxbackend.py 2017-07-11 14:55:38 +0000
+++ duplicity/backends/dpbxbackend.py 2017-11-25 19:53:45 +0000
@@ -41,7 +41,7 @@
from dropbox import Dropbox
from dropbox.exceptions import AuthError, BadInputError, ApiError
from dropbox.files import UploadSessionCursor, CommitInfo, WriteMode, \
- GetMetadataError, DeleteError, UploadSessionLookupError
+ GetMetadataError, DeleteError, UploadSessionLookupError, ListFolderError
from dropbox.oauth import DropboxOAuth2FlowNoRedirect
from requests.exceptions import ConnectionError
import time
@@ -383,15 +383,22 @@
remote_dir = '/' + urllib.unquote(self.parsed_url.path.lstrip('/')).rstrip()
log.Debug('dpbx.files_list_folder(%s)' % remote_dir)
- resp = self.api_client.files_list_folder(remote_dir)
- log.Debug('dpbx.list(%s): %s' % (remote_dir, resp))
-
res = []
- while True:
- res.extend([entry.name for entry in resp.entries])
- if not resp.has_more:
- break
- resp = self.api_client.files_list_folder_continue(resp.cursor)
+ try:
+ resp = self.api_client.files_list_folder(remote_dir)
+ log.Debug('dpbx.list(%s): %s' % (remote_dir, resp))
+
+ while True:
+ res.extend([entry.name for entry in resp.entries])
+ if not resp.has_more:
+ break
+ resp = self.api_client.files_list_folder_continue(resp.cursor)
+ except ApiError as e:
+ if (isinstance(e.error, ListFolderError) and e.error.is_path()
+ and e.error.get_path().is_not_found()):
+ log.Debug('dpbx.list(%s): ignore missing folder (%s)' % (remote_dir, e))
+ else:
+ raise
# Warn users of old version dpbx about automatically renamed files
self.check_renamed_files(res)
Follow ups