[CMF-checkins] CVS: CMF/CMFStaging - StagingTool.py:1.12

Shane Hathaway shane@cvs.zope.org
Mon, 5 Aug 2002 12:17:31 -0400


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

Modified Files:
	StagingTool.py 
Log Message:
Refined the status display to show checked out versions in other stages
(even though that should never happen) and added a utility "getObjectInStage".


=== CMF/CMFStaging/StagingTool.py 1.11 => 1.12 ===
         return res
 
 
-    def _getObjectVersionIds(self, object):
+    def _getObjectVersionIds(self, object, include_status=0):
         repo = self._getVersionRepository()
         stages = self._getObjectStages(object)
         res = {}
@@ -127,7 +127,11 @@
             if object is None or not repo.isUnderVersionControl(object):
                 res[stage_name] = None
             else:
-                res[stage_name] = repo.getVersionInfo(object).version_id
+                info = repo.getVersionInfo(object)
+                v = info.version_id
+                if include_status and info.status == info.CHECKED_OUT:
+                    v = str(v) + '+'
+                res[stage_name] = v
         return res
 
 
@@ -171,6 +175,14 @@
         return None
 
 
+    security.declareProtected(StageObjects, 'getObjectInStage')
+    def getObjectInStage(self, object, stage):
+        """Returns the version of the object in the given stage.
+        """
+        stages = self._getObjectStages(object)
+        return stages[stage]
+
+
     security.declareProtected(StageObjects, 'updateStages')
     def updateStages(self, object, from_stage, to_stages, message=''):
         """Updates corresponding objects to match the version
@@ -248,9 +260,9 @@
 
 
     security.declareProtected(StageObjects, 'getVersionIds')
-    def getVersionIds(self, object):
+    def getVersionIds(self, object, include_status=0):
         """Retrieves object version identifiers in the different stages."""
-        return self._getObjectVersionIds(object)
+        return self._getObjectVersionIds(object, include_status)
 
 
     def _checkContainers(self, object, stages, containers):