(di, old_data_item, group_memoizer, transaction)
return errors
Removes groups from data items and add new ones based on the group column.

    Note the removal does not happen within a context of the "transaction"
Removes groups from data items and add new ones based on the group column.
Removes groups from data items and add new ones based on the group column .
def _process_group_ownership(di, old_data_item, group_memoizer, transaction):
    """Removes groups from data items and add new ones based on the group column.

    Note the removal does not happen within a context of the "transaction"
    """
    errors = []
    old_groups = old_data_item.groups
    for group in old_groups:
        old_data_item.remove_group(group)

    for group_name in di.get('group', []):
        group = group_memoizer.by_name(group_name)
        if group:
            old_data_item.add_group(group, transaction=transaction)
        else:
            errors.append(
                _("Unknown group: '%(name)s'. But the row is successfully added")
                % {'name': group_name}
            )

    return errors
def _process_group_ownership ( di , old_data_item , group_memoizer , transaction ) : errors = [ ] old_groups = old_data_item . groups for group in old_groups : old_data_item . remove_group ( group ) for group_name in di . get ( 'group' , [ ] ) : group = group_memoizer . by_name ( group_name ) if group : old_data_item . add_group ( group , transaction = transaction ) else : errors . append ( _ ( "Unknown group: '%(name)s'. But the row is successfully added" ) % { 'name' : group_name } ) return errors