← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/gio-name into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/gio-name into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/gio-name/+merge/63565

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.
-- 
https://code.launchpad.net/~mterry/duplicity/gio-name/+merge/63565
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/gio-name into lp:duplicity.
=== modified file 'duplicity/backends/giobackend.py'
--- duplicity/backends/giobackend.py	2010-12-04 22:14:28 +0000
+++ duplicity/backends/giobackend.py	2011-06-06 15:06:36 +0000
@@ -126,12 +126,12 @@
         if not remote_filename:
             remote_filename = source_path.get_filename()
         source_file = gio.File(path=source_path.name)
-        target_file = self.remote_file.get_child_for_display_name(remote_filename)
+        target_file = self.remote_file.get_child(remote_filename)
         self.copy_file('put', source_file, target_file)
 
     def get(self, filename, local_path):
         """Get file and put in local_path (Path object)"""
-        source_file = self.remote_file.get_child_for_display_name(filename)
+        source_file = self.remote_file.get_child(filename)
         target_file = gio.File(path=local_path.name)
         self.copy_file('get', source_file, target_file)
         local_path.setdata()
@@ -139,7 +139,7 @@
     def list(self):
         """List files in that directory"""
         try:
-            enum = self.remote_file.enumerate_children(gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+            enum = self.remote_file.enumerate_children(gio.FILE_ATTRIBUTE_STANDARD_NAME,
                                                        gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)
         except Exception, e:
             self.handle_error(e, 'list', self.remote_file.get_parse_name())
@@ -147,7 +147,7 @@
         try:
             info = enum.next_file()
             while info:
-                files.append(info.get_display_name())
+                files.append(info.get_name())
                 info = enum.next_file()
             return files
         except Exception, e:
@@ -158,6 +158,6 @@
         assert type(filename_list) is not types.StringType
         try:
                 for filename in filename_list:
-                        self.remote_file.get_child_for_display_name(filename).delete()
+                        self.remote_file.get_child(filename).delete()
         except Exception, e:
-            self.handle_error(e, 'delete', self.remote_file.get_child_for_display_name(filename).get_parse_name())
+            self.handle_error(e, 'delete', self.remote_file.get_child(filename).get_parse_name())


Follow ups