Example #1
0
     if len(thisPrj) != 0 : # safeguard
         # fix serverparts....
         for sps in ["rw_serverparts_human", "ro_serverparts_human"] :
             serverparts=thisPrj[sps] 
             realKey=sps[:-6]
             thisPrj[realKey] = []
             for FSName,Part in serverparts :
                 FSUUID=afs.LookupUtil[afs.defaultConfig.CELL_NAME].getFSUUID(FSName)
                 if FSUUID == None :
                    sys.exit("Import Error: Cannot find server uuid for %s" % FSName)
                 thisPrj[realKey].append([FSUUID,Part])
         for k in ["rw_serverparts_human","ro_serverparts_human","rw_serverparts_raw","ro_serverparts_raw"]  :
             thisPrj.pop(k)
         PrjObj = Project()
         # id is in the dump, so we don't need to fetch it from database 
         PrjObj.setByDict(thisPrj)
         PS.saveProject(PrjObj)
         thisPrj={}
         print ("Successfully imported Project %s" % PrjObj.name)
     count += 1
     if count >= len(input) : break
     line=input[count].strip()
     tokens=line.split(":")
     tokens=map(string.strip,tokens)
     thisPrj["name"]=tokens[1]
     count +=1
     continue
 tokens=line.split(":")
 tokens=map(string.strip,tokens)
 if tokens[0] in defaultDict.keys()+["rw_serverparts_human","ro_serverparts_human","rw_serverparts_raw","ro_serverparts_raw"] :
    # list