コード例 #1
0
ファイル: ECQReference.py プロジェクト: dtgit/dtedu
    def manage_afterAdd(self, item, container):
        """Retain the reference after copy, even though the Archetypes
        people really don't want us to."""
        # find out if we got copied
        isCopy = getattr(item, '_v_is_cp', False)
        # make a copy of the reference
        if isCopy:
            refField = self.Schema().get('reference')
            refFieldValue = refField.get(self) \
                            or self.copiedReference
                
        # let the super class do its thing
        retVal = BaseContent.manage_afterAdd(self, item, container)
        
        # put the reference back
        if isCopy and refFieldValue:
            refField.set(self, refFieldValue)

        # sync the result objects (totally unrelated to the previous
        # code)
        self.syncResults('add')
        return retVal
コード例 #2
0
ファイル: ECQBaseAnswer.py プロジェクト: dtgit/dtedu
 def manage_afterAdd(self, item, container):
     retVal = BaseContent.manage_afterAdd(self, item, container)
     self.syncResults('add')
     return retVal