Example #1
0
def taxonomy_term_show_all(context, data_dict):
    """
    Shows a single taxonomy term and its children, the taxonomy id is not
    required, just a term_id.

    :returns: A single taxonomy term
    :rtype: A dictionary
    """
    _check_access('taxonomy_term_show', context, data_dict)

    label = data_dict.get('label')
    taxonomy_id = data_dict.get('taxonomy_id')

    if not label:
        raise logic.ValidationError("Either id, uri or label is required")

    if (taxonomy_id):
        term = TaxonomyTerm.get_from_taxonomy(label, taxonomy_id)
    else:
        term = TaxonomyTerm.get_all(label)

    if not term:
        raise logic.NotFound()

    return [u.as_dict() for u in term]