conduit r1685 - in trunk: . conduit/datatypes conduit/platform



Author: jstowers
Date: Fri Aug 29 23:36:04 2008
New Revision: 1685
URL: http://svn.gnome.org/viewvc/conduit?rev=1685&view=rev

Log:
	* conduit/datatypes/File.py:
	* conduit/platform/FileGnomeVfs.py:
	* conduit/platform/__init__.py: Refactor the returning of local
	paths to make it easier for gio.


Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/conduit/datatypes/File.py
   trunk/conduit/platform/FileGnomeVfs.py
   trunk/conduit/platform/__init__.py

Modified: trunk/conduit/datatypes/File.py
==============================================================================
--- trunk/conduit/datatypes/File.py	(original)
+++ trunk/conduit/datatypes/File.py	Fri Aug 29 23:36:04 2008
@@ -83,7 +83,8 @@
         
     def _is_tempfile(self):
         tmpdir = tempfile.gettempdir()
-        if self._file.is_local() and self._file.get_path().startswith(tmpdir):
+        path = self._file.get_local_path()
+        if self._file.is_local() and path and path.startswith(tmpdir):
             return True
         else:
             return False
@@ -316,9 +317,8 @@
         @returns: local absolute path the the file or None on error
         @rtype: C{string}
         """
-        if self.is_local():
-            return self._file.get_path()
-        else:
+        path = self._file.get_local_path()
+        if not path:
             return self.to_tempfile()
             
     def get_relative_uri(self):

Modified: trunk/conduit/platform/FileGnomeVfs.py
==============================================================================
--- trunk/conduit/platform/FileGnomeVfs.py	(original)
+++ trunk/conduit/platform/FileGnomeVfs.py	Fri Aug 29 23:36:04 2008
@@ -31,8 +31,11 @@
     def get_text_uri(self):
         return str(self._URI)
         
-    def get_path(self):
-        return self._URI.path
+    def get_local_path(self):
+        if self.is_local():
+            return self._URI.path
+        else:
+            return None
         
     def is_local(self):
         return self._URI.is_local

Modified: trunk/conduit/platform/__init__.py
==============================================================================
--- trunk/conduit/platform/__init__.py	(original)
+++ trunk/conduit/platform/__init__.py	Fri Aug 29 23:36:04 2008
@@ -8,7 +8,7 @@
     def get_text_uri(self):
         raise NotImplementedError
         
-    def get_path(self):
+    def get_local_path(self):
         raise NotImplementedError
         
     def is_local(self):



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