Пример #1
0
 def _notifyOfCopyTo(self, container, op=0):
     """Retain the reference after copy, even though the Archetypes
     people really don't want us to."""
     #log("_notifyOfCopyTo %s" % str(self))
     refField = self.Schema().get('reference')
     refFieldValue = refField.get(self)
     self.copiedReference = refFieldValue
     return BaseContent._notifyOfCopyTo(self, container, op=op)
Пример #2
0
 def _notifyOfCopyTo(self, container, op=0):
     """Retain the reference after copy, even though the Archetypes
     people really don't want us to."""
     #log("_notifyOfCopyTo %s" % str(self))
     refField = self.Schema().get('reference')
     refFieldValue = refField.get(self)
     self.copiedReference = refFieldValue
     return BaseContent._notifyOfCopyTo(self, container, op=op)
Пример #3
0
    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
Пример #4
0
    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
Пример #5
0
 def manage_beforeDelete(self, item, container):
     retVal = BaseContent.manage_beforeDelete(self, item, container)
     self.syncResults('delete')
     return retVal
Пример #6
0
 def manage_afterAdd(self, item, container):
     retVal = BaseContent.manage_afterAdd(self, item, container)
     self.syncResults('add')
     return retVal
Пример #7
0
 def manage_beforeDelete(self, item, container):
     retVal = BaseContent.manage_beforeDelete(self, item, container)
     self.syncResults('delete')
     return retVal
Пример #8
0
 def manage_afterAdd(self, item, container):
     retVal = BaseContent.manage_afterAdd(self, item, container)
     self.syncResults("add")
     return retVal