Commit 31bcdb5f authored by Ayush Tiwari's avatar Ayush Tiwari

Business Commit: Build Business Item object while editing if there has been change in item_path

parent ddff0b4a
...@@ -108,19 +108,17 @@ class BusinessCommit(Folder): ...@@ -108,19 +108,17 @@ class BusinessCommit(Folder):
PropertySheet.Version, PropertySheet.Version,
) )
def getPreviousCommit(self):
return self.prev_commit
security.declarePublic('newContent') security.declarePublic('newContent')
def newContent(self, id=None, **kw): def newContent(self, id=None, **kw):
""" """
Override newContent so as to use 'id' generated like hash Override newContent so as to use 'id' generated like hash.
Also, copy the objects in the Business Commit after creating new object
""" """
if id is None: if id is None:
id = self.generateNewId() id = self.generateNewId()
id = str(str(id) + '_' + str(time.time())).replace('.', '') id = str(str(id) + '_' + str(time.time())).replace('.', '')
return super(CommitTool, self).newContent(id, **kw) new_object = super(BusinessCommit, self).newContent(id, **kw)
import pdb; pdb.set_trace()
def getCommitHash(self): return new_object
return self.commit_hash
...@@ -713,10 +713,18 @@ class BusinessItem(XMLObject): ...@@ -713,10 +713,18 @@ class BusinessItem(XMLObject):
""" """
Overriden function so that we can update attributes for BusinessItem objects Overriden function so that we can update attributes for BusinessItem objects
""" """
return super(BusinessItem, self)._edit(item_path=item_path,
item_sign=item_sign, super(BusinessItem, self)._edit(item_path=item_path,
item_layer=item_layer, item_sign=item_sign,
**kw) item_layer=item_layer,
**kw)
# Build the object here, if the item_path has been added/updated
# XXX: We also need to add attribute to ensure that this doesn't happen
# while in tests or while creating them on the fly
import pdb; pdb.set_trace()
if 'item_path' in self._v_modified_property_dict:
self.build(self.aq_parent)
def build(self, context, **kw): def build(self, context, **kw):
""" """
......
...@@ -174,6 +174,9 @@ class CommitTool (BaseTool): ...@@ -174,6 +174,9 @@ class CommitTool (BaseTool):
def getCommitList(self): def getCommitList(self):
return self.objectValues(portal_type='Business Commit') return self.objectValues(portal_type='Business Commit')
def getSnapshotList(self):
return self.objectValues(portal_type='Business Snapshot')
security.declarePublic('newContent') security.declarePublic('newContent')
def newContent(self, id=None, **kw): def newContent(self, id=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