def update_device_info(self, device_info):
        """The application has updated one or more fields in the device
        information record and the cache needs to be updated to reflect the
        changes.  If this is a cached version of a persistent record then this
        is the opportunity to update the database."""
        if _debug: DeviceInfoCache._debug("update_device_info %r", device_info)

        # give this a reference count if it doesn't have one
        if not hasattr(device_info, '_ref_count'):
            device_info._ref_count = 0

        # get the current keys
        cache_id, cache_address = getattr(device_info, '_cache_keys', (None, None))

        if (cache_id is not None) and (device_info.deviceIdentifier != cache_id):
            if _debug: DeviceInfoCache._debug("    - device identifier updated")

            # remove the old reference, add the new one
            del self.cache[cache_id]
            self.cache[device_info.deviceIdentifier] = device_info

        if (cache_address is not None) and (device_info.address != cache_address):
            if _debug: DeviceInfoCache._debug("    - device address updated")

            # remove the old reference, add the new one
            del self.cache[cache_address]
            self.cache[device_info.address] = device_info

        # update the keys
        device_info._cache_keys = (device_info.deviceIdentifier, device_info.address)
def update_device_info ( self , device_info ) : if _debug : DeviceInfoCache . _debug ( "update_device_info %r" , device_info ) if not hasattr ( device_info , '_ref_count' ) : device_info . _ref_count = 0 cache_id , cache_address = getattr ( device_info , '_cache_keys' , ( None , None ) ) if ( cache_id is not None ) and ( device_info . deviceIdentifier != cache_id ) : if _debug : DeviceInfoCache . _debug ( "    - device identifier updated" ) del self . cache [ cache_id ] self . cache [ device_info . deviceIdentifier ] = device_info if ( cache_address is not None ) and ( device_info . address != cache_address ) : if _debug : DeviceInfoCache . _debug ( "    - device address updated" ) del self . cache [ cache_address ] self . cache [ device_info . address ] = device_info device_info . _cache_keys = ( device_info . deviceIdentifier , device_info . address )
The application has updated one or more fields in the device
        information record and the cache needs to be updated to reflect the
        changes.  If this is a cached version of a persistent record then this
        is the opportunity to update the database.