Back to index

plone3  3.1.7
Public Member Functions | Static Private Attributes
CMFEditions.StandardModifiers.NotRetainATRefs Class Reference

List of all members.

Public Member Functions

def beforeSaveModifier
def afterRetrieveModifier

Static Private Attributes

tuple __implements__ = (ISaveRetrieveModifier, )

Detailed Description

Modifier which removes Archetypes references of the working
   copy when reverting to a previous version without those references.
   We need to remove them explicitly by calling deleteReference() to
   keep the reference_catalog in sync, and to call the delHook().

Definition at line 618 of file StandardModifiers.py.


Member Function Documentation

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

Definition at line 630 of file StandardModifiers.py.

00630 
00631     def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
00632         # check if the modifier is called with a valid working copy
00633         if obj is None:
00634             return [], [], {}
00635 
00636         if not WRONG_AT:
00637             if IReferenceable.isImplementedBy(obj) and hasattr(aq_base(obj), REFERENCE_ANNOTATION) \
00638             and hasattr(aq_base(repo_clone), REFERENCE_ANNOTATION):
00639                 #Remove AT references that no longer exists in the retrived version
00640                 orig_refs_container = getattr(aq_base(obj), REFERENCE_ANNOTATION)
00641                 repo_clone_refs_container = getattr(aq_base(repo_clone), REFERENCE_ANNOTATION)
00642                 ref_objs = orig_refs_container.objectValues()
00643                 repo_clone_ref_ids = repo_clone_refs_container.objectIds()
00644 
00645                 reference_catalog = getToolByName(obj, 'reference_catalog')
00646                 if reference_catalog:
00647                     for ref in ref_objs:
00648                         if ref.getId() not in repo_clone_ref_ids:
00649                             reference_catalog.deleteReference(ref.sourceUID, ref.targetUID,
00650                                                               ref.relationship)
00651                 
00652         return [], [], {}
00653 
00654 InitializeClass(NotRetainATRefs)

Here is the call graph for this function:

Definition at line 627 of file StandardModifiers.py.

00627 
00628     def beforeSaveModifier(self, obj, clone):
00629         return {}, [], []


Member Data Documentation

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

Definition at line 625 of file StandardModifiers.py.


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