예제 #1
0
파일: smb.py 프로젝트: weijia/ufs
 def __init__(self, itemUrl):
     """
     ufsUrl = smb://mybook:[email protected]/
     itemUrl = mybook:[email protected]/
     """
     db = dictShoveDb.getDb("smbTmpInfo")
     try:
         userPass, server = itemUrl.split("@", 2)
         user, passwd = userPass.split(":",2)
     except ValueError:
         server = itemUrl
     server = server.replace("/",'\\')
     print server
     #Not mapped, map it
     #find an empty driver letter
     s = driverMapping.sys_driver_mapping()
     m = s.get_mapping()
     i = 'Z'
     while ord(i)>ord('A'):
         try:
             a = m[i]
         except KeyError:
             break
         i = chr(ord(i)-1)
     if ord(i) == ord('A'):
         raise "no driver letter available"
     print 'subst %s, %s'%(i, server)
     s.subst_driver(server, i)
     #Add ":/" to driver letter such as "C"+":/"
     self.fullPath = i+":/"
     self.parentDir = "winUfs"+configurationTools.getFsProtocolSeparator()+"%s"%winUfs.remoteDriverUuid
예제 #2
0
파일: ufsTreeItem.py 프로젝트: weijia/ufs
def getUfsTreeItem(ufsUrl, req):
    moduleName, itemUrl = ufsUrl.split(configurationTools.getFsProtocolSeparator(),2)
    try:
        ufsItemModule = __import__(moduleName, globals(),locals(),["getUfsTreeItem"], -1)
    except ImportError:
        ufsItemModule = __import__("localLibs.windows."+moduleName, globals(),locals(),["getUfsTreeItem"], -1)
        #print ufsItemModule.getUfsTreeItem(itemUrl, req).listNamedChildren()
    #import winUfs
    #return winUfs.getUfsTreeItem(itemUrl)
    #import sys
    #print >>sys.stderr, "creating item"
    #raise "hello world"
    return ufsItemModule.getUfsTreeItem(itemUrl, req)
예제 #3
0
파일: ufsV2.py 프로젝트: weijia/ufs
 def listNamedChildren(self, start = 0, cnt = None, getParent = True):
     #Return {fullPath:name}
     db = dbSys.dbSysSmart()
     #print "retriving co:", getUfsUuidItemUrl(self.id)
     co = collectionManager.getCollection(getUfsUuidItemUrl(self.id), db).getRange(0, None)
     #res = {getUfsUuidItemUrl(self.id):getUfsUuidItemUrl(self.id)}
     #res = {}
     #print "got co:", co
     res = odict.OrderedDict()
     #res["test"] = co
     #Hard code the freq items
     res[u"freq://root"] = u"Freqently Used"
     #Hard code the tag system
     res[u"tag://,"] = u"Tag System"
     #Hard code the task system
     res[u"tasklist://,"] = u"Task List"
     #Hard code the task system
     res[u"zippedColllectionWithInfo://,"] = u"Zipped Collections"
     #Storage List
     res[u"storage://"] = u"Storages"
     #Add other item in root item
     ns = nameService.nameService(db.getNameServiceDb())
     for i in co:
         n = ns.getName(i)
         if n is None:
             try:
                 #Get url
                 n = objTools.getUrlContent(i)
             except ValueError:
                 n = None
         if n is None:
             #Seems to be a directory path
             try:
                 n = objTools.getUfsBasename(i)
             except:
                 n = None
         if n is None:
             n = i
         res[i] = n
     if localDriverExist():
         res[u"winUfs"+configurationTools.getFsProtocolSeparator()+winUfs.winUfsRootItemUuid] = u"Filesystem"
     return res
예제 #4
0
파일: ufsTreeItem.py 프로젝트: weijia/ufs
def getItemUrl(ufsUrl):
    moduleName, itemUrl = ufsUrl.split(configurationTools.getFsProtocolSeparator(),2)
    return itemUrl
예제 #5
0
파일: winUfs.py 프로젝트: weijia/ufs
 def listNamedChildren(self, start = 0, cnt = None, getParent = True):
     #Return {fullPath:name}
     res = {u"winUfs"+configurationTools.getFsProtocolSeparator()+"%s"%localDriverUuid:localDriverName,
         u"winUfs"+configurationTools.getFsProtocolSeparator()+"%s"%remoteDriverUuid:remoteDriverName
     }
     return res
예제 #6
0
def getUfsUuidItemUrl(itemId=ufsRootItemUuid):
    return u"uuid" + configurationTools.getFsProtocolSeparator() + itemId
예제 #7
0
def getCollectionByProtocol(collectionId, dbSysInst):
    moduleName, itemUrl = collectionId.split(configurationTools.getFsProtocolSeparator(),2)
    collectionModule = __import__("libs.collection.modules."+moduleName, globals(),locals(),["getCollection"], -1)
    return collectionModule.getCollection(itemUrl, dbSysInst)