def build_embedded(embed, accession): data = get_relation(Accession, accession.id, embed, session=request.session) if isinstance(data, list): return (embed, [obj.json() for obj in data]) else: return (embed, data.json() if data else {})
def build_embedded(embed, taxon): if embed == 'synonyms': return (embed, [obj.json() for obj in taxon.synonyms]) data = get_relation(Taxon, taxon.id, embed, session=request.session) if isinstance(data, (list, types.GeneratorType)): return (embed, [obj.json() for obj in data]) else: return (embed, data.json() if data else {})
def build_embedded(embed, organization): data = get_relation(Organization, organization.id, embed, session=request.session) if isinstance(data, list): return (embed, [obj.json() for obj in data]) else: return (embed, data.json() if data else {})
def build_embedded(embed, genus): if embed == 'synonyms': # handle synonyms differently since they're an SA association list return (embed, [obj.json() for obj in genus.synonyms]) data = get_relation(Genus, genus.id, embed, session=request.session) if isinstance(data, (list, types.GeneratorType)): return (embed, [obj.json() for obj in data]) else: return (embed, data.json() if data else {})
def build_embedded(embed, plant): # if embed == 'synonyms': # data = genus.synonyms # else: # data = get_relation(Genus, genus.id, embed, session=request.session) data = get_relation(Plant, plant.id, embed, session=request.session) if isinstance(data, list): return (embed, [obj.json() for obj in data]) else: return (embed, data.json() if data else {})
def build_embedded(embed, family): if embed == 'synonyms': data = family.synonyms else: data = get_relation(Family, family.id, embed, session=request.session) return (embed, [obj.json() for obj in data])