Example #1
0
File: smb.py Project: weijia/ufs
 def __init__(self, itemUrl):
     """
     ufsUrl = smb://mybook:[email protected]/
     itemUrl = mybook:[email protected]/
     """
     db = dictShoveDb.getDb("smbTmpInfo")
     userPass, server = itemUrl.split("@", 2)
     user, passwd = userPass.split(":",2)
     server = "\\\\"+server.replace("/",'\\')
     try:
         self.driver = db[server]
     except KeyError:
         print 'not mapped'
         #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)
         
         db[server] = i
         self.driver = i
Example #2
0
File: smb.py Project: weijia/ufs
def main():
    s = driverMapping.sys_driver_mapping()
    m = s.get_mapping()
    for i in m:
        print i+":"+s.mapping[i]
    k = getUfsTreeItem("mybook:[email protected]/public")
    m = s.get_mapping()
    for i in m:
        print i+":"+s.mapping[i]