def by_id(cls, config_id): try: domain, wrapped = cls.by_id_mapping()[config_id] except KeyError: raise StaticDataSourceConfigurationNotFoundError( _('The data source referenced by this report could not be found.' )) return cls._get_datasource_config(wrapped, domain)
def by_id(cls, config_id): mapping = cls.by_id_mapping() if config_id not in mapping: mapping = cls.by_id_mapping(rebuild=True) metadata = mapping.get(config_id, None) if not metadata: raise StaticDataSourceConfigurationNotFoundError( _('The data source referenced by this report could not be found.' )) return cls._get_from_metadata(metadata)