Back to index

plone3  3.1.7
Private Member Functions
CMFEditions.StandardModifiers.OMBaseModifier Class Reference
Inheritance diagram for CMFEditions.StandardModifiers.OMBaseModifier:
Inheritance graph
[legend]

List of all members.

Private Member Functions

def _getOnCloneModifiers
def _beforeSaveModifier
def _getAttributeNamesHandlingSubObjects

Detailed Description

Base class for ObjectManager modifiers.

Definition at line 268 of file StandardModifiers.py.


Member Function Documentation

def CMFEditions.StandardModifiers.OMBaseModifier._beforeSaveModifier (   self,
  obj,
  clone 
) [private]
Returns all unititialized 'IVersionAwareReference' objects.

Definition at line 300 of file StandardModifiers.py.

00300 
00301     def _beforeSaveModifier(self, obj, clone):
00302         """Returns all unititialized 'IVersionAwareReference' objects.
00303         """
00304         portal_archivist = getToolByName(obj, 'portal_archivist')
00305         AttributeAdapter = portal_archivist.classes.AttributeAdapter
00306 
00307         # just return adapters to the attributes that were replaced by
00308         # a uninitialzed 'IVersionAwareReference' object
00309         result_refs = []
00310         for name in clone.objectIds():
00311             result_refs.append(AttributeAdapter(clone, name, type="ObjectManager"))
00312 
00313         return result_refs

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 314 of file StandardModifiers.py.

00314 
00315     def _getAttributeNamesHandlingSubObjects(self, obj, repo_clone):
00316         attrs = ['_objects']
00317         attrs.extend(repo_clone.objectIds())
00318         attrs.extend(obj.objectIds())
00319         return attrs

Here is the caller graph for this function:

Removes all childrens and returns them as references.

Definition at line 272 of file StandardModifiers.py.

00272 
00273     def _getOnCloneModifiers(self, obj):
00274         """Removes all childrens and returns them as references.
00275         """
00276         portal_archivist = getToolByName(obj, 'portal_archivist')
00277         VersionAwareReference = portal_archivist.classes.VersionAwareReference
00278 
00279         # do not pickle the object managers subobjects
00280         refs = {}
00281         result_refs = []
00282         for sub in obj.objectValues():
00283             result_refs.append(sub)
00284             refs[id(aq_base(sub))] = True
00285 
00286         def persistent_id(obj):
00287             try:
00288                 # return a non None value if it is one of the object
00289                 # managers subobjects or raise an KeyError exception
00290                 return refs[id(obj)]
00291             except KeyError:
00292                 # signalize the pickler to just pickle the 'obj' as
00293                 # usual
00294                 return None
00295 
00296         def persistent_load(ignored):
00297             return VersionAwareReference()
00298 
00299         return persistent_id, persistent_load, result_refs

Here is the call graph for this function:

Here is the caller graph for this function:


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