Back to index

plone3  3.1.7
IChangeSet.py
Go to the documentation of this file.
00001 # Copyright (c) 2003 The Connexions Project, All Rights Reserved
00002 # Written by Brent Hendricks
00003 
00004 """Interface for computing object differences"""
00005 
00006 from Interface import Attribute
00007 from Interface import Interface
00008 
00009 class IChangeSet(Interface):
00010     """And interface representing all of the differences between two objects"""
00011     
00012     same = Attribute('same', 'True if the fields are the "same"')
00013 
00014     def computeDiff(ob1, ob2, recursive=1, exclude=[]):
00015         """Compute the differences from ob1 to ob2 (ie. ob2 - ob1).
00016 
00017         If resursive is 1, compute differences between subobjects of
00018         ob1 and ob2 as well, excluding any subobjects whose IDs are
00019         listed in exclude
00020 
00021         The results can be accessed through getDiffs()"""
00022 
00023     def testChanges(ob):
00024         """Test the specified object to determine if the change set will apply cleanly.
00025 
00026         Returns None if there would be no erros
00027         """
00028 
00029     def applyChanges(ob):
00030         """Apply the computed changes to the specified object"""
00031         
00032     def getDiffs():
00033         """Returns the list of differences between the two objects.
00034 
00035         Each difference is a single object implementing the IDifference interface"""
00036 
00037     def getSubDiffs():
00038         """If the ChangeSet was computed recursively, returns a list
00039            of ChangeSet objects representing subobject differences
00040 
00041            Each ChangeSet will have the same ID as the objects whose
00042            difference it represents.
00043            """
00044 
00045     def getAddedItems():
00046         """If the ChangeSet was computed recursively, returns the list
00047         of IDs of items that were added.
00048 
00049         A copy of these items is available as a cubject of the ChangeSet
00050         """
00051 
00052     def getRemovedItems():
00053         """If the ChangeSet was computed recursively, returns the list
00054         of IDs of items that were removed"""
00055