[CMF-checkins] CVS: CMF/CMFStaging - StagingTool.py:1.23 VersionsTool.py:1.17

Sidnei da Silva sidnei at awkly.org
Wed Apr 21 10:15:05 EDT 2004


Update of /cvs-repository/CMF/CMFStaging
In directory cvs.zope.org:/tmp/cvs-serv1096

Modified Files:
	StagingTool.py VersionsTool.py 
Log Message:
More acquisition misbehavior fixing.


=== CMF/CMFStaging/StagingTool.py 1.22 => 1.23 ===
--- CMF/CMFStaging/StagingTool.py:1.22	Tue Apr 13 18:09:06 2004
+++ CMF/CMFStaging/StagingTool.py	Wed Apr 21 10:15:04 2004
@@ -37,7 +37,7 @@
 # Permission name
 StageObjects = 'Use version control'
 
-_wwwdir = os.path.join(os.path.dirname(__file__), 'www') 
+_wwwdir = os.path.join(os.path.dirname(__file__), 'www')
 
 
 class StagingError (Exception):
@@ -124,11 +124,17 @@
             stage = stages[stage_name]
             if stage is not None:
                 obj = stage.restrictedTraverse(rel_path, None)
-                if obj is not None and not obj.aq_inContextOf(stage, 1):
-                    # Avoid dangerous acquisition. Eg: acquiring
-                    # stuff from portal_skins or from above the stage
-                    # and being unable to stage an object with the same
-                    # id because the acquired object is non-versionable.
+                # Avoid dangerous acquisition. Eg: acquiring
+                # from higher level folders or from above the stage
+                # and being unable to stage an object with the same
+                # id because the acquired object is non-versionable
+                # or backed by a different version history.
+                if (obj is not None and
+                    (not obj.aq_inContextOf(obj.aq_parent, 1) or
+                    obj == aq_parent(obj))):
+                    # XXX aq_inContextOf returns true if
+                    # aq_parent is the same object, so acquiring a folder
+                    # through itself causes trouble!
                     obj = None
             else:
                 obj = None


=== CMF/CMFStaging/VersionsTool.py 1.16 => 1.17 ===
--- CMF/CMFStaging/VersionsTool.py:1.16	Mon Mar 29 15:14:20 2004
+++ CMF/CMFStaging/VersionsTool.py	Wed Apr 21 10:15:04 2004
@@ -32,7 +32,7 @@
 # Permission name
 UseVersionControl = 'Use version control'
 
-_wwwdir = os.path.join(os.path.dirname(__file__), 'www') 
+_wwwdir = os.path.join(os.path.dirname(__file__), 'www')
 
 
 class VersionsTool(UniqueObject, SimpleItemWithProperties):
@@ -42,7 +42,7 @@
 
     security = ClassSecurityInfo()
 
-    manage_options = ({'label' : 'Overview', 'action' : 'manage_overview'}, 
+    manage_options = ({'label' : 'Overview', 'action' : 'manage_overview'},
                       ) + SimpleItemWithProperties.manage_options
 
 
@@ -111,7 +111,7 @@
     security.declarePublic('checkout')
     def checkout(self, obj):
         """Opens the object for development.
-        
+
         Returns the object, which might be different from what was passed to
         the method if the object was replaced.
         """
@@ -182,7 +182,6 @@
                         obj.__dict__[key] = value
             repo.checkinResource(obj, message or '')
         return None
-
 
     security.declarePublic('getLogEntries')
     def getLogEntries(self, obj, only_checkins=0):




More information about the CMF-checkins mailing list