Compatibility layer for handling of datasource info

    datasource_id & datasource_type used to be passed in the URL
    directory, now they should come as part of the form_data,
    This function allows supporting both without duplicating code

def get_datasource_info(datasource_id, datasource_type, form_data):
    """Compatibility layer for handling of datasource info

    datasource_id & datasource_type used to be passed in the URL
    directory, now they should come as part of the form_data,
    This function allows supporting both without duplicating code"""
    datasource = form_data.get('datasource', '')
    if '__' in datasource:
        datasource_id, datasource_type = datasource.split('__')
        # The case where the datasource has been deleted
        datasource_id = None if datasource_id == 'None' else datasource_id

    if not datasource_id:
        raise Exception(
            'The datasource associated with this chart no longer exists')
    datasource_id = int(datasource_id)
    return datasource_id, datasource_type