(domain, table_def, replace, transaction)
return data_type, False, errors
Processes a FixtureDataType from an _FixtureTableDefinition, which gets
    its definition from one row in the "types" sheet in the uploaded excel sheet

    Returns a tuple with
      - (unsaved) FixtureDataType instance
      - boolean flag to indiicate if the data type was deleted
      - a list of errors
Processes a FixtureDataType from an _FixtureTableDefinition, which gets
    its definition from one row in the "types" sheet in the uploaded excel sheet
Processes a FixtureDataType from an _FixtureTableDefinition which gets its definition from one row in the types sheet in the uploaded excel sheet
def _create_data_type(domain, table_def, replace, transaction):
    """Processes a FixtureDataType from an _FixtureTableDefinition, which gets
    its definition from one row in the "types" sheet in the uploaded excel sheet

    Returns a tuple with
      - (unsaved) FixtureDataType instance
      - boolean flag to indiicate if the data type was deleted
      - a list of errors
    """
    errors = []

    new_data_type = FixtureDataType(
        domain=domain,
        is_global=table_def.is_global,
        tag=table_def.table_id,
        fields=table_def.fields,
        item_attributes=table_def.item_attributes
    )
    try:
        existing_data_type = FixtureDataType.fixture_tag_exists(domain, new_data_type.tag)
        if existing_data_type:
            data_type = existing_data_type
        # support old usage with 'UID'
        elif table_def.uid:
            data_type = FixtureDataType.get(table_def.uid)
        else:
            data_type = new_data_type

        if replace and data_type != new_data_type:
            data_type.recursive_delete(transaction)
            data_type = new_data_type

        data_type.fields = table_def.fields
        data_type.item_attributes = table_def.item_attributes
        data_type.is_global = table_def.is_global

        if data_type.domain != domain:
            data_type = new_data_type
            errors.append(
                _("'%(UID)s' is not a valid UID. But the new type is created.")
                % {'UID': table_def.uid}
            )
        if table_def.delete:
            data_type.recursive_delete(transaction)
            return data_type, True, errors
    except (ResourceNotFound, KeyError):
        data_type = new_data_type

    return data_type, False, errors
def _create_data_type ( domain , table_def , replace , transaction ) : errors = [ ] new_data_type = FixtureDataType ( domain = domain , is_global = table_def . is_global , tag = table_def . table_id , fields = table_def . fields , item_attributes = table_def . item_attributes ) try : existing_data_type = FixtureDataType . fixture_tag_exists ( domain , new_data_type . tag ) if existing_data_type : data_type = existing_data_type # support old usage with 'UID' elif table_def . uid : data_type = FixtureDataType . get ( table_def . uid ) else : data_type = new_data_type if replace and data_type != new_data_type : data_type . recursive_delete ( transaction ) data_type = new_data_type data_type . fields = table_def . fields data_type . item_attributes = table_def . item_attributes data_type . is_global = table_def . is_global if data_type . domain != domain : data_type = new_data_type errors . append ( _ ( "'%(UID)s' is not a valid UID. But the new type is created." ) % { 'UID' : table_def . uid } ) if table_def . delete : data_type . recursive_delete ( transaction ) return data_type , True , errors except ( ResourceNotFound , KeyError ) : data_type = new_data_type return data_type , False , errors