(top, path, gen_groupid)
return node
Starting at given top node make nodes and groups to satisfy the
    given path, where needed.  Return the node holding the leaf group.
    
    @param gen_groupid: Group ID factory from kpdb.Database instance.
Starting at given top node make nodes and groups to satisfy the
    given path, where needed.  Return the node holding the leaf group.
Starting at given top node make nodes and groups to satisfy the given path where needed . Return the node holding the leaf group .
def mkdir(top, path, gen_groupid):
    '''
    Starting at given top node make nodes and groups to satisfy the
    given path, where needed.  Return the node holding the leaf group.
    
    @param gen_groupid: Group ID factory from kpdb.Database instance.
    '''
    import infoblock

    path = path2list(path)
    pathlen = len(path)

    fg = FindGroupNode(path)
    node = walk(top,fg)

    if not node:                # make remaining intermediate folders
        node = fg.best_match or top
        pathlen -= len(fg.path)
        for group_name in fg.path:
            # fixme, this should be moved into a new constructor
            new_group = infoblock.GroupInfo()
            new_group.groupid = gen_groupid()
            new_group.group_name = group_name
            new_group.imageid = 1
            new_group.creation_time = datetime.datetime.now() 
            new_group.last_mod_time = datetime.datetime.now() 
            new_group.last_acc_time = datetime.datetime.now() 
            new_group.expiration_time = datetime.datetime(2999, 12, 28, 23, 59, 59) # KeePassX 0.4.3 default
            new_group.level = pathlen
            new_group.flags = 0
            new_group.order = [(1, 4), 
			       (2, len(new_group.group_name) + 1), 
			       (3, 5), 
			       (4, 5), 
			       (5, 5), 
			       (6, 5), 
			       (7, 4), 
			       (8, 2), 
			       (9, 4), 
			       (65535, 0)]
            pathlen += 1
            
            new_node = Node(new_group)
            node.nodes.append(new_node)
            
            node = new_node
            group = new_group
            continue
        pass
    return node
def mkdir ( top , path , gen_groupid ) : import infoblock path = path2list ( path ) pathlen = len ( path ) fg = FindGroupNode ( path ) node = walk ( top , fg ) if not node : # make remaining intermediate folders node = fg . best_match or top pathlen -= len ( fg . path ) for group_name in fg . path : # fixme, this should be moved into a new constructor new_group = infoblock . GroupInfo ( ) new_group . groupid = gen_groupid ( ) new_group . group_name = group_name new_group . imageid = 1 new_group . creation_time = datetime . datetime . now ( ) new_group . last_mod_time = datetime . datetime . now ( ) new_group . last_acc_time = datetime . datetime . now ( ) new_group . expiration_time = datetime . datetime ( 2999 , 12 , 28 , 23 , 59 , 59 ) # KeePassX 0.4.3 default new_group . level = pathlen new_group . flags = 0 new_group . order = [ ( 1 , 4 ) , ( 2 , len ( new_group . group_name ) + 1 ) , ( 3 , 5 ) , ( 4 , 5 ) , ( 5 , 5 ) , ( 6 , 5 ) , ( 7 , 4 ) , ( 8 , 2 ) , ( 9 , 4 ) , ( 65535 , 0 ) ] pathlen += 1 new_node = Node ( new_group ) node . nodes . append ( new_node ) node = new_node group = new_group continue pass return node