Exemple #1
0
def _remove_post_tag_name(post_id, tag_name):
    """ Removes a post-id form the set of tag-name -- post-ids. """
    db.srem(tag_name + APPEND_TAG_NAME_POSTS, str(post_id))
    if db.scard(tag_name + APPEND_TAG_NAME_POSTS) == 0:
        db.delete(tag_name + APPEND_TAG_NAME_POSTS)
Exemple #2
0
def get_favourite_count(username):
    """ Returns the number of favourited posts by a user. """
    if _is_user_created(username):
        return db.scard(username + APPEND_KEY_FAVS)
    else:
        return -1