Merge lp:~crosser/duplicity/dpbx-fix-file-listing into lp:~duplicity-team/duplicity/0.8-series

Proposed by Eugene Crosser
Status: Merged
Merged at revision: 1283
Proposed branch: lp:~crosser/duplicity/dpbx-fix-file-listing
Merge into: lp:~duplicity-team/duplicity/0.8-series
Diff against target: 43 lines (+16/-9)
1 file modified
duplicity/backends/dpbxbackend.py (+16/-9)
To merge this branch: bzr merge lp:~crosser/duplicity/dpbx-fix-file-listing
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+334277@code.launchpad.net

Description of the change

Included the code suggested by Kenneth to narrow down the exception that should be ignored.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backends/dpbxbackend.py'
2--- duplicity/backends/dpbxbackend.py 2017-07-11 14:55:38 +0000
3+++ duplicity/backends/dpbxbackend.py 2017-11-25 19:53:45 +0000
4@@ -41,7 +41,7 @@
5 from dropbox import Dropbox
6 from dropbox.exceptions import AuthError, BadInputError, ApiError
7 from dropbox.files import UploadSessionCursor, CommitInfo, WriteMode, \
8- GetMetadataError, DeleteError, UploadSessionLookupError
9+ GetMetadataError, DeleteError, UploadSessionLookupError, ListFolderError
10 from dropbox.oauth import DropboxOAuth2FlowNoRedirect
11 from requests.exceptions import ConnectionError
12 import time
13@@ -383,15 +383,22 @@
14 remote_dir = '/' + urllib.unquote(self.parsed_url.path.lstrip('/')).rstrip()
15
16 log.Debug('dpbx.files_list_folder(%s)' % remote_dir)
17- resp = self.api_client.files_list_folder(remote_dir)
18- log.Debug('dpbx.list(%s): %s' % (remote_dir, resp))
19-
20 res = []
21- while True:
22- res.extend([entry.name for entry in resp.entries])
23- if not resp.has_more:
24- break
25- resp = self.api_client.files_list_folder_continue(resp.cursor)
26+ try:
27+ resp = self.api_client.files_list_folder(remote_dir)
28+ log.Debug('dpbx.list(%s): %s' % (remote_dir, resp))
29+
30+ while True:
31+ res.extend([entry.name for entry in resp.entries])
32+ if not resp.has_more:
33+ break
34+ resp = self.api_client.files_list_folder_continue(resp.cursor)
35+ except ApiError as e:
36+ if (isinstance(e.error, ListFolderError) and e.error.is_path()
37+ and e.error.get_path().is_not_found()):
38+ log.Debug('dpbx.list(%s): ignore missing folder (%s)' % (remote_dir, e))
39+ else:
40+ raise
41
42 # Warn users of old version dpbx about automatically renamed files
43 self.check_renamed_files(res)

Subscribers

People subscribed via source and target branches