Commit 421b11a7 authored by Ayush Tiwari's avatar Ayush Tiwari

CommitTool: Get installed snapshot

parent c0de00bc
...@@ -178,6 +178,22 @@ class CommitTool (BaseTool): ...@@ -178,6 +178,22 @@ class CommitTool (BaseTool):
def getSnapshotList(self): def getSnapshotList(self):
return self.objectValues(portal_type='Business Snapshot') return self.objectValues(portal_type='Business Snapshot')
def getInstalledSnapshot(self):
"""
Return the installed snapshot.
Returns None in case there is no snapshot installed.
"""
snapshot = [l for l
in self.getSnapshotList()
if l.getValidationState() == 'installed']
if len(snapshot) == 1:
return snapshot[0]
elif len(snapshot) > 1:
raise ValueError('Multiple Snapshot in installed state')
else:
return None
security.declarePublic('newContent') security.declarePublic('newContent')
def newContent(self, id=None, portal_type=None, **kw): def newContent(self, id=None, portal_type=None, **kw):
""" """
......
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