commit/galaxy-central: carlfeberhard: API, Histories: fix (and simplify) tag filter
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b2b09f9e8513/ Changeset: b2b09f9e8513 User: carlfeberhard Date: 2015-01-29 18:50:05+00:00 Summary: API, Histories: fix (and simplify) tag filter Affected #: 1 file diff -r bcedc1c97e346fff6b3458b5339cac35ef37ffd0 -r b2b09f9e85130662ef02ee4ae887530e442f0e37 lib/galaxy/managers/base.py --- a/lib/galaxy/managers/base.py +++ b/lib/galaxy/managers/base.py @@ -938,31 +938,34 @@ return val in owner_annotation #TODO: to taggable - def _filter_tags( self, item, val, fn_name='__eq__' ): + def _tag_str_gen( self, item ): """ - Test whether the string version of any tag `fn_name`s (__eq__, contains) - `val`. + Return a list of strings built from the item's tags. """ #TODO: which user is this? all? for tag in item.tags: tag_str = tag.user_tname if tag.value is not None: tag_str += ":" + tag.user_value - if tag_str[ fn_name ]( val ): - return True - return False + yield tag_str def filter_has_partial_tag( self, item, val ): """ Return True if any tag partially contains `val`. """ - return self._filter_tags( item, val, fn_name='contains' ) + for tag_str in self._tag_str_gen( item ): + if val in tag_str: + return True + return False def filter_has_tag( self, item, val ): """ Return True if any tag exactly equals `val`. """ - return self._filter_tags( item, val, fn_name='__eq__' ) + for tag_str in self._tag_str_gen( item ): + if val == tag_str: + return True + return False def parse_bool( self, bool_string ): """ Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org