oplus/epm/record.py
def _update_value_inert(self, index, value):
        """
        is only called by _update_inert
        """
        # get field descriptor
        field_descriptor = self._table._dev_descriptor.get_field_descriptor(index)

        # prepare value
        value = field_descriptor.deserialize(value, index)

        # unregister previous link if relevant
        if isinstance(value, Link):
            # de-activate current link if any
            current_link = self._data.get(index)
            if current_link is not None:
                current_link.unregister()

        # unregister previous hook if relevant
        if isinstance(value, RecordHook):
            current_record_hook = self._data.get(index)
            if current_record_hook is not None:
                current_record_hook.unregister()

        # unregister previous external file if relevant
        if isinstance(value, ExternalFile):
            current_external_file = self._data.get(index)
            if current_external_file is not None:
                current_external_file._dev_unregister()

        # if None remove and leave
        if value in (None, NONE_RECORD_HOOK, NONE_LINK, NONE_EXTERNAL_FILE):
            # we don't check required, because this method is called by _update_inert which does the job
            self._dev_set_none_without_unregistering(index, check_not_required=False)
            return

        # if relevant, store current pk to signal table
        old_hook = None
        if index == 0 and not self._table._dev_auto_pk:
            old_hook = self._data.get(0)  # we use get, because record may not have a pk yet if it is being created

        # set value
        self._data[index] = value

        # signal pk update if relevant
        if old_hook is not None:
            self._table._dev_record_pk_was_updated(old_hook.target_value)
def _update_value_inert(self, index, value):
        # get field descriptor
        field_descriptor = self._table._dev_descriptor.get_field_descriptor(index)

        # prepare value
        value = field_descriptor.deserialize(value, index)

        # unregister previous link if relevant
        if isinstance(value, Link):
            # de-activate current link if any
            current_link = self._data.get(index)
            if current_link is not None:
                current_link.unregister()

        # unregister previous hook if relevant
        if isinstance(value, RecordHook):
            current_record_hook = self._data.get(index)
            if current_record_hook is not None:
                current_record_hook.unregister()

        # unregister previous external file if relevant
        if isinstance(value, ExternalFile):
            current_external_file = self._data.get(index)
            if current_external_file is not None:
                current_external_file._dev_unregister()

        # if None remove and leave
        if value in (None, NONE_RECORD_HOOK, NONE_LINK, NONE_EXTERNAL_FILE):
            # we don't check required, because this method is called by _update_inert which does the job
            self._dev_set_none_without_unregistering(index, check_not_required=False)
            return

        # if relevant, store current pk to signal table
        old_hook = None
        if index == 0 and not self._table._dev_auto_pk:
            old_hook = self._data.get(0)  # we use get, because record may not have a pk yet if it is being created

        # set value
        self._data[index] = value

        # signal pk update if relevant
        if old_hook is not None:
            self._table._dev_record_pk_was_updated(old_hook.target_value)
def _update_value_inert ( self , index , value ) : # get field descriptor field_descriptor = self . _table . _dev_descriptor . get_field_descriptor ( index ) # prepare value value = field_descriptor . deserialize ( value , index ) # unregister previous link if relevant if isinstance ( value , Link ) : # de-activate current link if any current_link = self . _data . get ( index ) if current_link is not None : current_link . unregister ( ) # unregister previous hook if relevant if isinstance ( value , RecordHook ) : current_record_hook = self . _data . get ( index ) if current_record_hook is not None : current_record_hook . unregister ( ) # unregister previous external file if relevant if isinstance ( value , ExternalFile ) : current_external_file = self . _data . get ( index ) if current_external_file is not None : current_external_file . _dev_unregister ( ) # if None remove and leave if value in ( None , NONE_RECORD_HOOK , NONE_LINK , NONE_EXTERNAL_FILE ) : # we don't check required, because this method is called by _update_inert which does the job self . _dev_set_none_without_unregistering ( index , check_not_required = False ) return # if relevant, store current pk to signal table old_hook = None if index == 0 and not self . _table . _dev_auto_pk : old_hook = self . _data . get ( 0 ) # we use get, because record may not have a pk yet if it is being created # set value self . _data [ index ] = value # signal pk update if relevant if old_hook is not None : self . _table . _dev_record_pk_was_updated ( old_hook . target_value )
is only called by _update_inert
is only called by _update_inert