Beispiel #1
0
def initialize_db():
    root_node = api.get_root_folder()['data'][0]
    root = db.get()
    root['root_node'] = root_node
    virtual_root = get_virtual_root(root_node)
    index = OOBTree(virtual_root)
    db.update()
    root['index'] = index
Beispiel #2
0
def initialize_db():
    root_node = api.get_root_folder()['data'][0]
    root = db.get()
    root['root_node'] = root_node
    virtual_root = get_virtual_root(root_node)
    index = OOBTree(virtual_root)
    db.update()
    root['index'] = index
Beispiel #3
0
def build_index():
    root_node = api.get_root_folder()['data'][0]
    root = db.get()
    root['root_node'] = root_node
    virtual_root = get_virtual_root(root_node)
    index = OOBTree(virtual_root)

    def process_folder(folder):
        if 'children' not in folder:
            folder['children'] = OOBTree()
        result = api.call('nodes/%s/children' % folder['id'], 'metadata').json()
        if len(result) == 0:
            return
        for node in result['data']:
            node = OOBTree(node)
            folder['children'][node['name']] = node
            if node['kind'] == 'FOLDER':
                process_folder(node)

    process_folder(index)
    db.update()
    root['index'] = index
    transaction.commit()
Beispiel #4
0
def build_index():
    root_node = api.get_root_folder()['data'][0]
    root = db.get()
    root['root_node'] = root_node
    virtual_root = get_virtual_root(root_node)
    index = OOBTree(virtual_root)

    def process_folder(folder):
        if 'children' not in folder:
            folder['children'] = OOBTree()
        result = api.call('nodes/%s/children' % folder['id'],
                          'metadata').json()
        if len(result) == 0:
            return
        for node in result['data']:
            node = OOBTree(node)
            folder['children'][node['name']] = node
            if node['kind'] == 'FOLDER':
                process_folder(node)

    process_folder(index)
    db.update()
    root['index'] = index
    transaction.commit()