示例#1
0
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
示例#2
0
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
示例#3
0
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
示例#4
0
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
示例#5
0
def get_searchable_prop_or_disc(context, default):
    if IProposal.providedBy(context) or IDiscussionPost.providedBy(context):
        return context.text
    return default
示例#6
0
def get_searchable_prop_or_disc(context, default):
    if IProposal.providedBy(context) or IDiscussionPost.providedBy(context):
        return context.text
    return default