Back to index

plone3  3.1.7
getVersionDiff.py
Go to the documentation of this file.
00001 ## Script (Python) "onEditChangeSet"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=id1, id2
00008 ##title=Compute object differences
00009 ##
00010 
00011 retrieve = context.portal_repository.retrieve
00012 
00013 if id1 == 'current':
00014     ob1 = context
00015 else:
00016     ob1 = retrieve(context, int(id1)).object
00017 
00018 ob2 = retrieve(context, int(id2)).object
00019 base_id = ob1.getId()
00020 diff = context.portal_diff.createChangeSet(ob2, ob1,
00021                                            id1=ob2.getId()+' (rev. %s)'%id2,
00022                                            id2=ob1.getId()+' (rev. %s)'%id1)
00023 return diff