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):
PropertySheet.Version,
)
def getPreviousCommit(self):
return self.prev_commit
security.declarePublic('newContent')
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:
id = self.generateNewId()
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 self.commit_hash
return new_object
......@@ -713,11 +713,19 @@ class BusinessItem(XMLObject):
"""
Overriden function so that we can update attributes for BusinessItem objects
"""
return super(BusinessItem, self)._edit(item_path=item_path,
super(BusinessItem, self)._edit(item_path=item_path,
item_sign=item_sign,
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):
"""
Extract value for the given path from the OFS
......
......@@ -174,6 +174,9 @@ class CommitTool (BaseTool):
def getCommitList(self):
return self.objectValues(portal_type='Business Commit')
def getSnapshotList(self):
return self.objectValues(portal_type='Business Snapshot')
security.declarePublic('newContent')
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