def get_tags(object, default): """ We only use tags for Discussions and Proposals. Warning! An empty list doesn't update the catalog. If default is returned to an index, it will cause that index to remove index, which is the correct behaviour for the catalog. """ if IDiscussionPost.providedBy(object) or IProposal.providedBy(object): return tuple(object.get_tags(default)) return default
def get_like_userids(object, default): """ Returns all userids who 'like' something. We only use like for Discussions and Proposals. Warning! An empty list doesn't update the catalog. If default is returned to an index, it will cause that index to remove index, which is the correct behaviour for the catalog. """ if IDiscussionPost.providedBy(object) or IProposal.providedBy(object): user_tags = getAdapter(object, IUserTags) likes = user_tags.userids_for_tag('like') if likes: return likes return default
def get_searchable_prop_or_disc(context, default): if IProposal.providedBy(context) or IDiscussionPost.providedBy(context): return context.text return default