Changeset 1066

Show
Ignore:
Timestamp:
02/13/08 09:57:16
Author:
mylan
Message:

Fix problem with unreferencable objects in fix_linkintegrity function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneSkinDump/branches/plone_3.0/skin_template/fixes.py

    r1031 r1066  
     1from Acquisition import aq_base 
    12from Products.CMFCore.utils import getToolByName 
    23from Products.ZCatalog.ProgressHandler import ZLogHandler 
     
    2021def fix_linkintegrity(ob): 
    2122    """Fix losed references.""" 
    22     ob_li_refs = reference_catalog.getReferences(ob, relationship=li_relation) 
    23     if ob_li_refs: 
    24         annotations = ob._getReferenceAnnotations() 
    25         uniqueUIDs = uid_catalog.uniqueValuesFor('UID') 
    26         # delete references to non-existent objects 
    27         [annotations._delObject(ref.id) for ref in ob_li_refs \ 
    28          if not ref.targetUID in uniqueUIDs] 
     23    uobject = aq_base(ob) 
     24    if reference_catalog.isReferenceable(uobject): 
     25        ob_li_refs = reference_catalog.getReferences(ob, relationship=li_relation) 
     26        if ob_li_refs: 
     27            annotations = ob._getReferenceAnnotations() 
     28            uniqueUIDs = uid_catalog.uniqueValuesFor('UID') 
     29            # delete references to non-existent objects 
     30            [annotations._delObject(ref.id) for ref in ob_li_refs \ 
     31             if not ref.targetUID in uniqueUIDs] 
    2932         
    3033def fix_all(ob):