From ac2b820a30af1da51ff72979cf422ceeff41fade Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 11 Jun 2017 22:57:08 -0700 Subject: [PATCH] Add PDBTagMixin.get_root_tags --- etiquette/photodb.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index c0498c4..fef0831 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -889,6 +889,11 @@ class PDBTagMixin: def get_tags(self): yield from self.get_things(thing_type='tag') + def get_root_tags(self): + for tag in self.get_tags(): + if tag.parent() is None: + yield tag + @decorators.required_feature('enable_new_tag') @decorators.transaction def new_tag(self, tagname, description=None, *, commit=True):