conduit r1190 - in trunk: . conduit/datatypes conduit/modules/FspotModule



Author: jstowers
Date: Fri Jan 11 03:04:41 2008
New Revision: 1190
URL: http://svn.gnome.org/viewvc/conduit?rev=1190&view=rev

Log:
Fix Fspot bug with misuse of force_new_filename

Modified:
   trunk/ChangeLog
   trunk/conduit/datatypes/File.py
   trunk/conduit/modules/FspotModule/FspotDbusModule.py

Modified: trunk/conduit/datatypes/File.py
==============================================================================
--- trunk/conduit/datatypes/File.py	(original)
+++ trunk/conduit/datatypes/File.py	Fri Jan 11 03:04:41 2008
@@ -221,13 +221,13 @@
                 oldname = self.get_filename()
                 olduri = self._get_text_uri()
                 newuri = olduri.replace(oldname, filename)
-
-                log.debug("Trying to rename file %s (%s) -> %s (%s)" % (olduri,oldname,newuri,filename))
-                gnomevfs.set_file_info(self.URI,newInfo,gnomevfs.SET_FILE_INFO_NAME)
-
-                #close so the file info is re-read
-                self.URI = gnomevfs.URI(newuri)
-                self._close_file()
+                
+                if filename != oldname:
+                    log.debug("Trying to rename file %s (%s) -> %s (%s)" % (olduri,oldname,newuri,filename))
+                    gnomevfs.set_file_info(self.URI,newInfo,gnomevfs.SET_FILE_INFO_NAME)
+                    #close so the file info is re-read
+                    self.URI = gnomevfs.URI(newuri)
+                    self._close_file()
             except gnomevfs.NotSupportedError:
                 #dunno what this is
                 self._defer_rename(filename)
@@ -237,6 +237,9 @@
             except gnomevfs.NotPermittedError:
                 #file is on readonly filesystem
                 self._defer_rename(filename)
+            except gnomevfs.FileExistsError:
+                #I think this is when you rename a file to its current name
+                pass
                 
     def force_new_file_extension(self, ext):
         """

Modified: trunk/conduit/modules/FspotModule/FspotDbusModule.py
==============================================================================
--- trunk/conduit/modules/FspotModule/FspotDbusModule.py	(original)
+++ trunk/conduit/modules/FspotModule/FspotDbusModule.py	Fri Jan 11 03:04:41 2008
@@ -95,17 +95,13 @@
         Image.ImageTwoWay.get(self, LUID)
 
         properties = self.photo_remote.GetPhotoProperties (LUID)
-
         photouri = properties['Uri']
-        name = str(properties['Name'])
         tags = properties['Tags'].split(',')
 
         f = Photo.Photo(URI=photouri)
         f.set_UID(LUID)
         f.set_open_URI(photouri)
-        f.force_new_filename (name)
-        f.set_tags (tags)
-
+        f.set_tags(tags)
         return f
 
     def _upload_photo (self, uploadInfo):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]