Exemplo n.º 1
0
def render_field_allowed_values(field):
    if not 'allowed_values' in field:
        return ''
    allowed_values = ', '.join(
        ecs_helpers.list_extract_keys(field['allowed_values'], 'name'))

    return field_acceptable_value_names(allowed_values=allowed_values,
                                        flat_name=field['flat_name'],
                                        dashed_name=field['dashed_name'])
def extract_allowed_values_key_names(field):
    """Extracts the `name` keys from the field's
       allowed_values if present in the field
       object.

    :param field: The target field
    """
    if not field.get('allowed_values'):
        return []
    return ecs_helpers.list_extract_keys(field['allowed_values'], 'name')