Exemplo n.º 1
0
def find_bookmark_collection(user):
    bookmark_collection = Node.find(
        Q('is_bookmark_collection', 'eq', True)
        & Q('contributors', 'eq', user._id))
    if bookmark_collection.count() == 0:
        new_bookmark_collection(user)
    return bookmark_collection[0]
Exemplo n.º 2
0
def migrate():
    targets = get_targets()
    total = len(targets)
    for i, user in enumerate(targets):
        logger.info('({}/{}) Preparing to migrate User {}'.format(i + 1, total, user._id))
        bookmark = new_bookmark_collection(user)
        bookmark.save()
        logger.info('Successfully migrated User {}'.format(user._id))
    logger.info('Successfully migrated {} users'.format(total))
Exemplo n.º 3
0
def find_bookmark_collection(user):
    bookmark_collection = Node.find(Q('is_bookmark_collection', 'eq', True) & Q('contributors', 'eq', user._id))
    if bookmark_collection.count() == 0:
        new_bookmark_collection(user)
    return bookmark_collection[0]
Exemplo n.º 4
0
def find_bookmark_collection(user):
    bookmark_collection = Node.find(Q("is_bookmark_collection", "eq", True) & Q("contributors", "eq", user._id))
    if bookmark_collection.count() == 0:
        new_bookmark_collection(user)
    return bookmark_collection[0]