(domain, replace, data_type, di, item_fields, item_attributes, sort_key)
return old_data_item, delete, errors
Processes a FixtureDataItem from its excel upload.

    Returns a tuple with
      - (unsaved) FixtureDataItem instance
      - boolean flag to indiicate if the data item was deleted
      - a list of errors
Processes a FixtureDataItem from its excel upload.
Processes a FixtureDataItem from its excel upload .
def _process_data_item(domain, replace, data_type, di, item_fields, item_attributes, sort_key):
    """Processes a FixtureDataItem from its excel upload.

    Returns a tuple with
      - (unsaved) FixtureDataItem instance
      - boolean flag to indiicate if the data item was deleted
      - a list of errors
    """
    delete = False
    errors = []
    new_data_item = FixtureDataItem(
        domain=domain,
        data_type_id=data_type.get_id,
        fields=item_fields,
        item_attributes=item_attributes,
        sort_key=sort_key
    )
    try:
        if di['UID'] and not replace:
            old_data_item = FixtureDataItem.get(di['UID'])
        else:
            old_data_item = new_data_item
        old_data_item.fields = item_fields
        old_data_item.item_attributes = item_attributes
        if (old_data_item.domain != domain
                or not old_data_item.data_type_id == data_type.get_id):
            old_data_item = new_data_item
            errors.append(
                _("'%(UID)s' is not a valid UID. But the new item is created.")
                % {'UID': di['UID']}
            )
        if di[DELETE_HEADER] == "Y" or di[DELETE_HEADER] == "y":
            delete = True
    except (ResourceNotFound, KeyError):
        old_data_item = new_data_item

    return old_data_item, delete, errors
def _process_data_item ( domain , replace , data_type , di , item_fields , item_attributes , sort_key ) : delete = False errors = [ ] new_data_item = FixtureDataItem ( domain = domain , data_type_id = data_type . get_id , fields = item_fields , item_attributes = item_attributes , sort_key = sort_key ) try : if di [ 'UID' ] and not replace : old_data_item = FixtureDataItem . get ( di [ 'UID' ] ) else : old_data_item = new_data_item old_data_item . fields = item_fields old_data_item . item_attributes = item_attributes if ( old_data_item . domain != domain or not old_data_item . data_type_id == data_type . get_id ) : old_data_item = new_data_item errors . append ( _ ( "'%(UID)s' is not a valid UID. But the new item is created." ) % { 'UID' : di [ 'UID' ] } ) if di [ DELETE_HEADER ] == "Y" or di [ DELETE_HEADER ] == "y" : delete = True except ( ResourceNotFound , KeyError ) : old_data_item = new_data_item return old_data_item , delete , errors