コード例 #1
0
ファイル: Module.py プロジェクト: ballju/conduit
    def load_all(self, whitelist, blacklist):
        """
        Loads all classes in the configured paths.

        If whitelist and blacklist are supplied then the name of the file
        is tested against them. Default policy is to load all modules unless
        """
        for f in self.filelist:
            name, ext = Vfs.uri_get_filename_and_extension(f)
            if whitelist:
                if name in whitelist:
                    self._load_modules_in_file(f)
            elif blacklist:
                if name not in blacklist:
                    self._load_modules_in_file(f)
            else:
                self._load_modules_in_file(f)

        for i in self.dataproviderFactories:
            i.connect("dataprovider-removed", self._on_dynamic_dataprovider_removed)
            i.connect("dataprovider-added", self._on_dynamic_dataprovider_added)
            i.probe()

        self.emit("all-modules-loaded")
コード例 #2
0
ファイル: Module.py プロジェクト: fpemud/conduit-daemon
    def load_all(self, whitelist, blacklist):
        """
        Loads all classes in the configured paths.

        If whitelist and blacklist are supplied then the name of the file
        is tested against them. Default policy is to load all modules unless
        """
        for f in self.filelist:
            name, ext = Vfs.uri_get_filename_and_extension(f)
            if whitelist:
                if name in whitelist:
                    self._load_modules_in_file(f)
            elif blacklist:
                if name not in blacklist: 
                    self._load_modules_in_file(f)
            else:            
                self._load_modules_in_file(f)

        for i in self.dataproviderFactories:
            i.connect("dataprovider-removed", self._on_dynamic_dataprovider_removed)
            i.connect("dataprovider-added", self._on_dynamic_dataprovider_added)
            i.probe()

        self.emit('all-modules-loaded')
コード例 #3
0
ファイル: TestCoreVfs.py プロジェクト: ProfSteve/conduit
from common import *
import conduit.vfs as Vfs
import conduit.vfs.File as VfsFile
import conduit.utils as Utils

ok("--- TESTING VFS WITH FILE IMPL: %s" % Vfs.backend_name(), True)
ok("Supports remote uri schemes: %s" % Vfs.backend_supports_remote_uri_schemes(), True)

safe = '/&=:@'
unsafe = ' !<>#%()[]{}'
safeunsafe = '%20%21%3C%3E%23%25%28%29%5B%5D%7B%7D'

ok("Dont escape path characters",Vfs.uri_escape(safe+unsafe) == safe+safeunsafe)
ok("Unescape back to original",Vfs.uri_unescape(safe+safeunsafe) == safe+unsafe)
ok("Get protocol", Vfs.uri_get_protocol("file:///foo/bar") == "file://")
name, ext = Vfs.uri_get_filename_and_extension("file:///foo/bar.ext")
ok("Get filename (%s,%s)" % (name,ext), name == "bar" and ext == ".ext")
ok("file:///home exists", Vfs.uri_exists("file:///home") == True)
ok("/home exists", Vfs.uri_exists("/home") == True)
ok("/home is folder", Vfs.uri_is_folder("/home") == True)
ok("/foo/bar does not exist", Vfs.uri_exists("/foo/bar") == False)
ok("format uri", Vfs.uri_format_for_display("file:///foo") == "/foo")

tmpdiruri = Utils.new_tempdir()

# Test the folder scanner theading stuff
fileuri = Utils.new_tempfile("bla").get_local_uri()
stm = VfsFile.FolderScannerThreadManager(maxConcurrentThreads=1)

def prog(*args): pass
def done(*args): pass