[conduit] Test if file implementation supports remote uris



commit cda59710e7b5cefdec4a20cb352a023c77bc2311
Author: John Stowers <john stowers gmail com>
Date:   Sat Apr 25 12:50:20 2009 +1200

    Test if file implementation supports remote uris
    
    Add Vfs.supports_remote_uri_schemes() and associated test
    which returns true if the fileimple backend supports more
    than file:// uri schemes
---
 conduit/Vfs.py                   |    7 +++++++
 test/python-tests/TestCoreVfs.py |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/conduit/Vfs.py b/conduit/Vfs.py
index 7a031c9..6c66933 100644
--- a/conduit/Vfs.py
+++ b/conduit/Vfs.py
@@ -22,6 +22,13 @@ FileMonitor     = FileImpl.FileMonitor
 FolderScanner   = FileImpl.FolderScanner
 FileTransfer    = FileImpl.FileTransferImpl
 
+def backend_supports_remote_uri_schemes():
+    """
+    @returns: True if the file implementation supports non-local (file://)
+    uri schemes
+    """
+    return len(FileImpl.FileImpl.SCHEMES) > 1 and "file://" in FileImpl.FileImpl.SCHEMES
+
 def uri_is_valid(uri):
     """
     Checks if the uri is valid (i.e. not a local path), and its type
diff --git a/test/python-tests/TestCoreVfs.py b/test/python-tests/TestCoreVfs.py
index 0086245..04f444a 100644
--- a/test/python-tests/TestCoreVfs.py
+++ b/test/python-tests/TestCoreVfs.py
@@ -9,7 +9,7 @@ for impl in ("GIO", "GnomeVfs",):
     reload(Utils)
 
     ok("--- TESTING VFS WITH FILE IMPL: %s" % impl, True)
-    #print Vfs.FolderScanner
+    ok("Supports remote uri schemes: %s" % Vfs.backend_supports_remote_uri_schemes(), True)
 
     safe = '/&=:@'
     unsafe = ' !<>#%()[]{}'



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