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
def __init__(self, dbName): self.db = dictShoveDb.getDb(dbName)