def _notifyOfCopyTo(self, container, op=0):
        """This method is here, because the 'reference' attribute of
        'ECQReference' objects is not copied by default. So
        we call '_notifyOfCopyTo()' to tell every
        'ECQReference' object to back up its 'reference'
        attribute.

        In Archetypes 1.4, this should not be necessary anymore
        because there will be switch to enable copying the contents of
        ReferenceFields.
        """
        # log("%s._notifyOfCopyTo()" % str(self))
        for obj in self.contentValues():
            obj._notifyOfCopyTo(self, op=op)
        return ECQFolder._notifyOfCopyTo(self, container, op=op)
Exemple #2
0
    def mcContentValues(self):
        """Same as 'listFolderContents()' except that for elements of
        type 'ECQReference', the referenced object is returned,
        wrapped in a 'ReferenceWrapper.'
        """
        def getRefOrSelf(obj):
            if obj.portal_type == ECQReference.portal_type:
                refObj = obj.getReference()
                if refObj:
                    obj = ReferenceWrapper(self, refObj)
                else:
                    obj = None
                    
            return obj

        contents = ECQFolder.contentValues(self)
        ret = []
        for o in contents:
            refOrSelf = getRefOrSelf(o)
            if refOrSelf:
                ret.append(refOrSelf)
        return ret