Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CMFDiffTool.ChangeSet.ChangeSet Class Reference
Inheritance diagram for CMFDiffTool.ChangeSet.ChangeSet:
Inheritance graph
[legend]
Collaboration diagram for CMFDiffTool.ChangeSet.ChangeSet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __getitem__
def computeDiff
def getId
def testChanges
def applyChanges
def getDiffs
def getSubDiffs
def getAddedItems
def getRemovedItems

Public Attributes

 id
 title
 ob1_path
 ob2_path
 recursive

Static Public Attributes

string meta_type = "Change Set"
string portal_type = "ChangeSet"
tuple security = ClassSecurityInfo()
tuple same = ComputedAttribute(_isSame)

Private Member Functions

def _addSubSet

Private Attributes

 _p_changed

Static Private Attributes

tuple __implements__

Detailed Description

A persistent skinnable contentish Change Set

Definition at line 226 of file ChangeSet.py.


Constructor & Destructor Documentation

def CMFDiffTool.ChangeSet.ChangeSet.__init__ (   self,
  id,
  title = '' 
)
ChangeSet constructor

Reimplemented from CMFDiffTool.ChangeSet.BaseChangeSet.

Definition at line 241 of file ChangeSet.py.

00241 
00242     def __init__(self, id, title=''):
00243         BaseChangeSet.__init__(self, id, title='')
00244         DefaultDublinCoreImpl.__init__(self)


Member Function Documentation

Reimplemented from CMFDiffTool.ChangeSet.BaseChangeSet.

Definition at line 245 of file ChangeSet.py.

00245 
00246     def __getitem__(self, key):
00247         SkinnedFolder.__getitem__(self, key)

Here is the caller graph for this function:

def CMFDiffTool.ChangeSet.ChangeSet._addSubSet (   self,
  id,
  ob1,
  ob2,
  exclude,
  id1,
  id2 
) [private]

Reimplemented from CMFDiffTool.ChangeSet.BaseChangeSet.

Definition at line 267 of file ChangeSet.py.

00267 
00268     def _addSubSet(self, id, ob1, ob2, exclude, id1, id2):
00269         self.manage_addProduct['CMFDiffTool'].manage_addChangeSet(id,
00270                                                   title='Changes to: %s' % id)
00271         transaction.savepoint(optimistic=True)
00272         self[id].computeDiff(ob1[id], ob2[id], exclude=exclude, id1=id1, id2=id2)
00273 
00274 
00275 InitializeClass(ChangeSet)

Here is the call graph for this function:

def CMFDiffTool.ChangeSet.BaseChangeSet.applyChanges (   self,
  ob 
) [inherited]
Apply the change set to the specified object

Definition at line 176 of file ChangeSet.py.

00176 
00177     def applyChanges(self, ob):
00178         """Apply the change set to the specified object"""
00179         for d in self._diffs:
00180             d.applyChanges(ob)
00181 
00182         if self._removed:
00183             ob.manage_delObjects(self._removed)
00184 
00185         for id in self._added:
00186             child = self[id]
00187             ob.manage_clone(child, id)
00188 
00189         for id in self._changed:
00190             cs = self[id]
00191             child = ob[id]
00192             cs.applyChanges(child)

def CMFDiffTool.ChangeSet.ChangeSet.computeDiff (   self,
  ob1,
  ob2,
  recursive = 1,
  exclude = [],
  id1 = None,
  id2 = None 
)
Compute the differences from ob1 to ob2 (ie. ob2 - ob1).

The results can be accessed through getDiffs()

Reimplemented from CMFDiffTool.ChangeSet.BaseChangeSet.

Definition at line 248 of file ChangeSet.py.

00248 
00249     def computeDiff(self, ob1, ob2, recursive=1, exclude=[], id1=None, id2=None):
00250         self.manage_delObjects(self.objectIds())
00251         BaseChangeSet.computeDiff(self, ob1, ob2, recursive, exclude, id1, id2)
00252         if recursive and ob1.isPrincipiaFolderish:
00253             # Clone any added subobjects
00254             for id in self._added:
00255                 ob = ob2[id]
00256                 logger.log(logging.DEBUG, "ChangeSet: cloning %s (%s)" % (id, ob))
00257                 try:
00258                     self.manage_clone(ob, id)
00259                 except CopyError:
00260                     # If one of the objects isn't actually local to the ZODB
00261                     # (i.e. it is a version in some other repository), this
00262                     # will fail
00263                     pass
00264 
00265         self._p_changed = 1

Here is the call graph for this function:

Here is the caller graph for this function:

If the ChangeSet was computed recursively, returns the list
of IDs of items that were added.

A copy of these items is available as a cubject of the ChangeSet

Definition at line 211 of file ChangeSet.py.

00211 
00212     def getAddedItems(self):
00213         """If the ChangeSet was computed recursively, returns the list
00214         of IDs of items that were added.
00215 
00216         A copy of these items is available as a cubject of the ChangeSet
00217         """
00218         return list(self._added)

Returns the list differences between the two objects.

Each difference is a single object implementing the IDifference interface

Definition at line 194 of file ChangeSet.py.

00194 
00195     def getDiffs(self):
00196         """Returns the list differences between the two objects.
00197 
00198         Each difference is a single object implementing the IDifference interface"""
00199         return self._diffs

def CMFDiffTool.ChangeSet.BaseChangeSet.getId (   self) [inherited]
ChangeSet id

Definition at line 89 of file ChangeSet.py.

00089 
00090     def getId(self):
00091         """ChangeSet id"""
00092         return self.id

If the ChangeSet was computed recursively, returns the list
of IDs of items that were removed

Definition at line 220 of file ChangeSet.py.

00220 
00221     def getRemovedItems(self):
00222         """If the ChangeSet was computed recursively, returns the list
00223         of IDs of items that were removed"""
00224         return list(self._removed)
00225 

If the ChangeSet was computed recursively, returns a list
   of ChangeSet objects representing subjects differences

   Each ChangeSet will have the same ID as the objects whose
   difference it represents.

Definition at line 201 of file ChangeSet.py.

00201 
00202     def getSubDiffs(self):
00203         """If the ChangeSet was computed recursively, returns a list
00204            of ChangeSet objects representing subjects differences
00205 
00206            Each ChangeSet will have the same ID as the objects whose
00207            difference it represents.
00208            """
00209         return [self[id] for id in self._changed]

def CMFDiffTool.ChangeSet.BaseChangeSet.testChanges (   self,
  ob 
) [inherited]
Test the specified object to determine if the change set will apply without errors

Definition at line 165 of file ChangeSet.py.

00165 
00166     def testChanges(self, ob):
00167         """Test the specified object to determine if the change set will apply without errors"""
00168         for d in self._diffs:
00169             d.testChanges(ob)
00170 
00171         for id in self._changed:
00172             cs = self[id]
00173             child = ob[id]
00174             cs.testChanges(child)

Here is the caller graph for this function:


Member Data Documentation

Initial value:
(BaseChangeSet.__implements__ +
                            SkinnedFolder.__implements__ +
                            DefaultDublinCoreImpl.__implements__)

Reimplemented from CMFDiffTool.ChangeSet.BaseChangeSet.

Definition at line 233 of file ChangeSet.py.

Definition at line 264 of file ChangeSet.py.

Definition at line 78 of file ChangeSet.py.

string CMFDiffTool.ChangeSet.ChangeSet.meta_type = "Change Set" [static]

Definition at line 228 of file ChangeSet.py.

Definition at line 83 of file ChangeSet.py.

Definition at line 84 of file ChangeSet.py.

string CMFDiffTool.ChangeSet.ChangeSet.portal_type = "ChangeSet" [static]

Definition at line 229 of file ChangeSet.py.

Definition at line 86 of file ChangeSet.py.

tuple CMFDiffTool.ChangeSet.BaseChangeSet.same = ComputedAttribute(_isSame) [static, inherited]

Definition at line 101 of file ChangeSet.py.

tuple CMFDiffTool.ChangeSet.ChangeSet.security = ClassSecurityInfo() [static]

Reimplemented from CMFDiffTool.ChangeSet.BaseChangeSet.

Definition at line 230 of file ChangeSet.py.

Definition at line 79 of file ChangeSet.py.


The documentation for this class was generated from the following file: