예제 #1
0
파일: manager.py 프로젝트: 7flying/yil-pil
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)
예제 #2
0
파일: manager.py 프로젝트: 7flying/yil-pil
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