From bf4a3980e08392fad9a38c4cf3149715add2ba7c Mon Sep 17 00:00:00 2001 From: Florent Guillaume <fg@nuxeo.com> Date: Mon, 24 May 2004 10:22:40 +0000 Subject: [PATCH] I added the method 'getSubscriberDocumentVerion'. This method pupose is to replace the method 'getSubscriberDocumentPath'. The new method takes a docid and create a new version of that document while the old (and still currently in use) function created a new object in the repository with an invalid docid ('xxxx_conflict_copy' is not a valid docid) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@900 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5SyncML/SynchronizationTool.py | 35 ++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/product/ERP5SyncML/SynchronizationTool.py b/product/ERP5SyncML/SynchronizationTool.py index 1b000d76cd..7eddaec012 100755 --- a/product/ERP5SyncML/SynchronizationTool.py +++ b/product/ERP5SyncML/SynchronizationTool.py @@ -24,7 +24,7 @@ # ############################################################################## -"""\ +""" ERP portal_synchronizations tool. """ @@ -71,6 +71,10 @@ class SynchronizationTool( UniqueObject, SimpleItem, id = 'portal_synchronizations' meta_type = 'ERP5 Synchronizations' + # On the server, this is use to keep track of the temporary + # copies. + objectsToRemove = [] + security = ClassSecurityInfo() # @@ -453,6 +457,35 @@ class SynchronizationTool( UniqueObject, SimpleItem, LOG('getPublisherDocument publisher_object',0,publisher_object) return publisher_object + + def getSubscriberDocumentVersion(self, conflict, docid): + """ + Given a 'conflict' and a 'docid' refering to a new version of a + document, applies the conflicting changes to the document's new + version. By so, two differents versions of the same document will be + available. + Thus, the manager will be able to open both version of the document + before selecting which one to keep. + """ + + subscriber = conflict.getSubscriber() + publisher_object_path = conflict.getObjectPath() + publisher_object = self.unrestrictedTraverse(publisher_object_path) + publisher_xml = self.getXMLObject(object=publisher_object,xml_mapping\ + = subscriber.getXMLMapping()) + + directory = publisher_object.aq_parent + object_id = docid + if object_id in directory.objectIds(): + directory._delObject(object_id) + conduit = ERP5Conduit() + conduit.addNode(xml=publisher_xml,object=directory,object_id=object_id) + subscriber_document = directory._getOb(object_id) + for c in self.getConflictList(conflict.getObjectPath()): + if c.getSubscriber() == subscriber: + c.applySubscriberValue(object=subscriber_document) + return subscriber_document + security.declareProtected(Permissions.AccessContentsInformation, 'getSubscriberDocumentPath') def getSubscriberDocumentPath(self, conflict): """ -- 2.30.9