示例#1
0
 def getObjId(self, fullPath):
     #format the path
     fullPath = transform.transformDirToInternal(fullPath)
     try:
         #Find the id in database
         id = self.dbSys.getPath2ObjIdShove()[fullPath][0]
         if not objTools.isUuid(id):
             id = objTools.getUrlForUuid(id)
         #print 'existing id:', id
         return id
     except KeyError:
         #Not in db, add a new id for the obj
         newId = unicode(uuid.uuid4())
         #Add ref for 2 database
         self.dbSys.getPath2ObjIdShove()[fullPath] = objTools.getUrlForUuid(newId)
         self.dbSys.getObjId2PathShove()[newId] = fullPath
         return newId
示例#2
0
 def getCached(self, objId):
     if objTools.isUuid(objId):
         objId = objTools.getUuid(objId)
     #print 'get cached returns objid:',objId
     return self.dbSys.getObjId2PathShove()[objId][0]