Back to index

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

List of all members.

Public Member Functions

def beforeSaveModifier
def afterRetrieveModifier

Static Private Attributes

tuple __implements__ = (ISaveRetrieveModifier, )

Detailed Description

Modifier which ensures uid consistency by retaining the uid from the working copy.  Ensuring
   that newly created objects are assigned an appropriate uid is a job for the repository tool.

Definition at line 553 of file StandardModifiers.py.


Member Function Documentation

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

Definition at line 563 of file StandardModifiers.py.

00563 
00564     def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
00565         # check if the modifier is called with a valid working copy
00566         if obj is None:
00567             return [], [], {}
00568 
00569         #Preserve CMFUid
00570         uid_tool = getToolByName(obj, 'portal_historyidhandler', None)
00571         if uid_tool is not None:
00572             working_uid = uid_tool.queryUid(obj)
00573             copy_uid = uid_tool.queryUid(repo_clone)
00574             anno_tool = getToolByName(obj, 'portal_uidannotation')
00575             annotation = anno_tool(repo_clone, uid_tool.UID_ATTRIBUTE_NAME)
00576             annotation.setUid(working_uid)
00577 
00578         #Preserve ATUID
00579         uid = getattr(aq_base(obj), 'UID', None)
00580         if UUID_ATTR is not None and uid is not None and callable(obj.UID):
00581             working_atuid = obj.UID()
00582             repo_uid = repo_clone.UID()
00583             setattr(repo_clone, UUID_ATTR, working_atuid)
00584             if working_atuid != repo_uid:
00585                 # XXX: We need to do something with forward references
00586                 annotations = repo_clone._getReferenceAnnotations()
00587                 for ref in annotations.objectValues():
00588                     ref.sourceUID = working_atuid
00589 
00590         return [], [], {}
00591 
00592 InitializeClass(RetainUIDs)

Here is the call graph for this function:

Definition at line 560 of file StandardModifiers.py.

00560 
00561     def beforeSaveModifier(self, obj, clone):
00562         return {}, [], []


Member Data Documentation

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

Definition at line 558 of file StandardModifiers.py.


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