Merge lp:~mterry/duplicity/gio-name into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Approved by: Kenneth Loafman
Approved revision: 724
Merged at revision: 735
Proposed branch: lp:~mterry/duplicity/gio-name
Merge into: lp:duplicity/0.6
Diff against target: 45 lines (+6/-6)
1 file modified
duplicity/backends/giobackend.py (+6/-6)
To merge this branch: bzr merge lp:~mterry/duplicity/gio-name
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+63565@code.launchpad.net

Description of the change

I've recently discovered that sometimes (at least on WebDAV), the server will not provide a GIO "display name", but will provide a GIO "name". (one is utf-8 formatted and is designed for user-presentation, the other is just a filename)

Since these strings aren't presented to user (just used in list results and get, put, and delete arguments), using just 'name' is fine.

And 'name' will always be available, whereas display name won't.

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/giobackend.py'
2--- duplicity/backends/giobackend.py 2010-12-04 22:14:28 +0000
3+++ duplicity/backends/giobackend.py 2011-06-06 15:06:36 +0000
4@@ -126,12 +126,12 @@
5 if not remote_filename:
6 remote_filename = source_path.get_filename()
7 source_file = gio.File(path=source_path.name)
8- target_file = self.remote_file.get_child_for_display_name(remote_filename)
9+ target_file = self.remote_file.get_child(remote_filename)
10 self.copy_file('put', source_file, target_file)
11
12 def get(self, filename, local_path):
13 """Get file and put in local_path (Path object)"""
14- source_file = self.remote_file.get_child_for_display_name(filename)
15+ source_file = self.remote_file.get_child(filename)
16 target_file = gio.File(path=local_path.name)
17 self.copy_file('get', source_file, target_file)
18 local_path.setdata()
19@@ -139,7 +139,7 @@
20 def list(self):
21 """List files in that directory"""
22 try:
23- enum = self.remote_file.enumerate_children(gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
24+ enum = self.remote_file.enumerate_children(gio.FILE_ATTRIBUTE_STANDARD_NAME,
25 gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)
26 except Exception, e:
27 self.handle_error(e, 'list', self.remote_file.get_parse_name())
28@@ -147,7 +147,7 @@
29 try:
30 info = enum.next_file()
31 while info:
32- files.append(info.get_display_name())
33+ files.append(info.get_name())
34 info = enum.next_file()
35 return files
36 except Exception, e:
37@@ -158,6 +158,6 @@
38 assert type(filename_list) is not types.StringType
39 try:
40 for filename in filename_list:
41- self.remote_file.get_child_for_display_name(filename).delete()
42+ self.remote_file.get_child(filename).delete()
43 except Exception, e:
44- self.handle_error(e, 'delete', self.remote_file.get_child_for_display_name(filename).get_parse_name())
45+ self.handle_error(e, 'delete', self.remote_file.get_child(filename).get_parse_name())

Subscribers

People subscribed via source and target branches

to all changes: