Commit 00afb318 authored by Jim Fulton's avatar Jim Fulton

Added a check to prevent deleting a version while the user is *in* the

version.
parent 2ca037b6
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Version object""" """Version object"""
__version__='$Revision: 1.35 $'[11:-2] __version__='$Revision: 1.36 $'[11:-2]
import Globals, time import Globals, time
from AccessControl.Role import RoleManager from AccessControl.Role import RoleManager
...@@ -162,7 +162,6 @@ class Version(Persistent,Implicit,RoleManager,Item): ...@@ -162,7 +162,6 @@ class Version(Persistent,Implicit,RoleManager,Item):
"""Begin working in a version""" """Begin working in a version"""
RESPONSE.setCookie( RESPONSE.setCookie(
Globals.VersionNameName, self.cookie, Globals.VersionNameName, self.cookie,
#expires="Mon, 27-Dec-99 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'], path=REQUEST['SCRIPT_NAME'],
) )
if (REQUEST.has_key('SERVER_SOFTWARE') and if (REQUEST.has_key('SERVER_SOFTWARE') and
...@@ -180,7 +179,7 @@ class Version(Persistent,Implicit,RoleManager,Item): ...@@ -180,7 +179,7 @@ class Version(Persistent,Implicit,RoleManager,Item):
"""Temporarily stop working in a version""" """Temporarily stop working in a version"""
RESPONSE.setCookie( RESPONSE.setCookie(
Globals.VersionNameName,'No longer active', Globals.VersionNameName,'No longer active',
expires="Mon, 27-Aug-84 23:59:59 GMT", expires="Mon, 25-Jan-1999 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'], path=REQUEST['SCRIPT_NAME'],
) )
if (REQUEST.has_key('SERVER_SOFTWARE') and if (REQUEST.has_key('SERVER_SOFTWARE') and
...@@ -251,4 +250,19 @@ class Version(Persistent,Implicit,RoleManager,Item): ...@@ -251,4 +250,19 @@ class Version(Persistent,Implicit,RoleManager,Item):
'Attempt to %sdelete a non-empty version.<p>' 'Attempt to %sdelete a non-empty version.<p>'
((self is not item) and 'indirectly ' or '')) ((self is not item) and 'indirectly ' or ''))
try: REQUEST=self.REQUEST
except: pass
else:
v=self.cookie
if REQUEST.get(Globals.VersionNameName, '') == v:
raise 'Version error', (
'An attempt was made to delete a version, %s, or an\n'
'object containing %s while\n working in the\n'
'version %s. This would lead to a &quot;version\n'
'paradox&quot;. The object containing the deleted\n'
'object would be locked and it would be impossible\n'
'to clear the lock by saving or discarding the\n'
'version, because the version would no longer\n'
'be accessable.<p>\n'
% (v,v,v))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment