

@classmethod
def process(c, request, name=None):
    '\n        process uses the current request to determine which menus\n        should be visible, which are selected, etc.\n        '
    c.load_menus()
    c.sort_menus()
    if (name is None):
        items = {
            
        }
        for name in c.items:
            items[name] = c.process(request, name)
        return items
    if (name not in c.items):
        return []
    items = copy.deepcopy(c.items[name])
    curitem = None
    for item in items:
        item.process(request)
        if item.visible:
            item.selected = False
            if item.match_url(request):
                if ((curitem is None) or (len(curitem.url) < len(item.url))):
                    curitem = item
    if (curitem is not None):
        curitem.selected = True
    visible = [item for item in items if item.visible]
    if getattr(settings, 'MENU_SELECT_PARENTS', False):

        def is_child_selected(item):
            for child in item.children:
                if (child.selected or is_child_selected(child)):
                    return True
        for item in visible:
            if is_child_selected(item):
                item.selected = True
    return visible

dataset/ETHPy150Open borgstrom/django-simple-menu/menu/menu.py Menu.process/original