Back to index

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

List of all members.

Public Member Functions

def getOnCloneModifiers
def beforeSaveModifier
def afterRetrieveModifier

Static Private Attributes

tuple __implements__ = (ICloneModifier, ISaveRetrieveModifier)

Detailed Description

ObjectManager modifier treating all childrens as inside refs

Treats all childrens as inside references (the repository layer
knows what to do with that fact).

Definition at line 373 of file StandardModifiers.py.


Member Function Documentation

def CMFEditions.StandardModifiers.OMInsideChildrensModifier.afterRetrieveModifier (   self,
  obj,
  repo_clone,
  preserve = () 
)

Definition at line 396 of file StandardModifiers.py.

00396 
00397     def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
00398         # check if the modifier is called with a valid working copy
00399         if obj is None:
00400             return [], [], {}
00401 
00402         hidhandler = getToolByName(obj, 'portal_historyidhandler')
00403         queryUid = hidhandler.queryUid
00404 
00405         # Inside refs from the original object that have no counterpart
00406         # in the repositories clone have to be deleted from the original.
00407         # The following steps have to be carried out:
00408         #
00409         # 1. list all inside references of the original
00410         # 2. remove from the list the inside references that just will be
00411         #    reverted from the repository
00412         # 3. Return the remaining inside objects that have to be removed
00413         #    from the original.
00414 
00415         # (1) list originals inside references
00416         orig_histids = {}
00417         for id, o in obj.objectItems():
00418             histid = queryUid(o, None)
00419             # there may be objects without history_id
00420             # We want to make sure to delete these on revert
00421             if histid is not None:
00422                 orig_histids[histid] = id
00423             else:
00424                 orig_histids['no_history'+id]=id
00425 
00426         # (2) evaluate the refs that get replaced anyway
00427         for varef in repo_clone.objectValues():
00428             histid = varef.history_id
00429             if histid in orig_histids:
00430                 del orig_histids[histid]
00431 
00432         # (3) build the list of adapters to the references to be removed
00433         refs_to_be_deleted = \
00434             [OMSubObjectAdapter(obj, name) for name in orig_histids.values()]
00435 
00436         # return all attribute names that have something to do with
00437         # referencing
00438         ref_names = self._getAttributeNamesHandlingSubObjects(obj, repo_clone)
00439         return refs_to_be_deleted, ref_names, {}
00440 
00441 InitializeClass(OMInsideChildrensModifier)

Here is the call graph for this function:

Returns all unititialized 'IVersionAwareReference' objects.

This allways goes in conjunction with 'getOnCloneModifiers'.

Definition at line 388 of file StandardModifiers.py.

00388 
00389     def beforeSaveModifier(self, obj, clone):
00390         """Returns all unititialized 'IVersionAwareReference' objects.
00391 
00392         This allways goes in conjunction with 'getOnCloneModifiers'.
00393         """
00394         inside_refs = self._beforeSaveModifier(obj, clone)
00395         return {}, inside_refs, []

Here is the call graph for this function:

Removes all childrens and returns them as references.

Definition at line 382 of file StandardModifiers.py.

00382 
00383     def getOnCloneModifiers(self, obj):
00384         """Removes all childrens and returns them as references.
00385         """
00386         pers_id, pers_load, inside_refs = self._getOnCloneModifiers(obj)
00387         return pers_id, pers_load, inside_refs, [], ''

Here is the call graph for this function:


Member Data Documentation

tuple CMFEditions.StandardModifiers.OMInsideChildrensModifier.__implements__ = (ICloneModifier, ISaveRetrieveModifier) [static, private]

Definition at line 380 of file StandardModifiers.py.


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