make sure that on deletion of a version of a resource also the current version is being reset to the previous one
This commit is contained in:
parent
2638fb83f2
commit
e13a79eca5
1 changed files with 4 additions and 1 deletions
|
@ -209,7 +209,6 @@ class VersionableResource(object):
|
|||
def cleanupVersions(context, event):
|
||||
""" Called upon deletion of a resource.
|
||||
"""
|
||||
#print 'cleaning up'
|
||||
vContext = IVersionable(context, None)
|
||||
if vContext is None:
|
||||
return
|
||||
|
@ -225,3 +224,7 @@ def cleanupVersions(context, event):
|
|||
vId = vContext.versionId
|
||||
vMaster = IVersionable(vContext.master)
|
||||
del vMaster.versions[vId]
|
||||
if vMaster.getVersioningAttribute('currentVersion', None) == context:
|
||||
newCurrent = sorted(vMaster.versions.items())[-1][1]
|
||||
vMaster.setVersioningAttribute('currentVersion', newCurrent)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue