attribut storeRevisions à la classe ObjectsVirtualServer pour permettre (si
positionné à 0) de ne pas enregistrer les révisions successives d'un objet. + modifs de style dans getIdsAllowedToModifyObject et l'autre
This commit is contained in:
parent
2113012131
commit
ffb05e799c
|
@ -595,6 +595,7 @@ class ObjectsVirtualServer(AdministrableVirtualServer):
|
|||
nextLocalId = 1
|
||||
objects = None
|
||||
objectSaveActions = None
|
||||
storeRevisions = 1
|
||||
|
||||
def canLoadObjectCore(self, objectId):
|
||||
return self.objects.has_key(objectId)
|
||||
|
@ -747,7 +748,7 @@ class ObjectsVirtualServer(AdministrableVirtualServer):
|
|||
object.releaseNonCore()
|
||||
|
||||
def savePendingRequests(self, saveNeeded = 0):
|
||||
if self.objectSaveActions is not None:
|
||||
if self.storeRevisions and self.objectSaveActions is not None:
|
||||
for objectId in self.objectSaveActions.keys():
|
||||
if self.objectSaveActions[objectId] != 'save':
|
||||
continue
|
||||
|
@ -1980,26 +1981,20 @@ class ObjectsServer(AdministrableServerMixin, Server):
|
|||
admin.acquireNonCore()
|
||||
adminsObjectIds = admin.adminsSet
|
||||
|
||||
if adminsObjectIds and type(adminsObjectIds) == type([]):
|
||||
if adminsObjectIds and type(adminsObjectIds) is type([]):
|
||||
for adminObjectId in adminsObjectIds:
|
||||
allowedObjectIds += getSetContainedIds([adminObjectId])
|
||||
|
||||
if object.hasSlotName('writersSet'):
|
||||
adminsObjectIds = object.getSlot('writersSet').getValue()
|
||||
if adminsObjectIds and type(adminsObjectIds) == type([]):
|
||||
if adminsObjectIds and type(adminsObjectIds) is type([]):
|
||||
for adminObjectId in adminsObjectIds:
|
||||
allowedObjectIds += getSetContainedIds([adminObjectId])
|
||||
|
||||
allowedObjectIds.sort()
|
||||
uniqueAllowedObjectIds = []
|
||||
oldId = None
|
||||
while len(allowedObjectIds) > 0:
|
||||
allowedId = allowedObjectIds.pop()
|
||||
if not (allowedId == oldId):
|
||||
uniqueAllowedObjectIds.append(allowedId)
|
||||
oldId = allowedId
|
||||
|
||||
return uniqueAllowedObjectIds
|
||||
d = {}
|
||||
for k in allowedObjectIds:
|
||||
d[k] = 0
|
||||
return d.keys()
|
||||
|
||||
|
||||
def getIdsAllowedToModifyObject(self, objectId):
|
||||
|
@ -2017,30 +2012,21 @@ class ObjectsServer(AdministrableServerMixin, Server):
|
|||
admin.acquireNonCore()
|
||||
adminsObjectIds = admin.adminsSet
|
||||
|
||||
if adminsObjectIds and type(adminsObjectIds) == type([]):
|
||||
if adminsObjectIds and type(adminsObjectIds) is type([]):
|
||||
for adminObjectId in adminsObjectIds:
|
||||
allowedObjectIds += getSetContainedIds([adminObjectId])
|
||||
|
||||
if object.hasSlotName('writersSet'):
|
||||
adminsObjectIds = object.getSlot('writersSet').getValue()
|
||||
if adminsObjectIds and type(adminsObjectIds) == type([]):
|
||||
if adminsObjectIds and type(adminsObjectIds) is type([]):
|
||||
for adminObjectId in adminsObjectIds:
|
||||
allowedObjectIds += getSetContainedIds([adminObjectId])
|
||||
|
||||
allowedObjectIds.sort()
|
||||
uniqueAllowedObjectIds = []
|
||||
oldId = None
|
||||
while len(allowedObjectIds) > 0:
|
||||
allowedId = allowedObjectIds.pop()
|
||||
if not (allowedId == oldId):
|
||||
uniqueAllowedObjectIds.append(allowedId)
|
||||
oldId = allowedId
|
||||
|
||||
return uniqueAllowedObjectIds
|
||||
d = {}
|
||||
for k in allowedObjectIds:
|
||||
d[k] = 0
|
||||
return d.keys()
|
||||
|
||||
|
||||
|
||||
|
||||
def getLastObjectIds(self, objectsCount, possibleReadersSet,
|
||||
possibleWritersSet):
|
||||
"""Retrieve the last accessed objects ids.
|
||||
|
|
Reference in New Issue