#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gluon import *

def getMenu(id):
    # busco los datos de los hijos en la db
    
    db = current.db
    menus = db((db.menu.parent == id) & (db.menu.is_enabled == 
True)).select(db.menu.page, db.menu.name, db.menu.id, db.menu.url_internal, 
db.menu.url_external, orderby = db.menu.priority)
    # declaro una lista Hijo
    menu_child = []
    # recorro la tabla de los hijos
    for menu in menus:
        menu_other = getMenu(menu.id)
        # aƱado a la lista hijo cada uno de los registros encontrados
        if menu.url_external and menu.url_internal:
            menu_child.append([current.T(menu.name), False, 
menu.url_external+menu.url_internal, menu_other])
        elif menu.url_external:
            menu_child.append([current.T(menu.name), False, 
menu.url_external, menu_other])
        elif menu.url_internal:
            menu_child.append([current.T(menu.name), False, A(menu.name, 
_href=URL("default", "index", args=[menu.page])+menu.url_internal, 
**{'_data-target': menu.url_internal}), menu_other])
        else:
            menu_child.append([current.T(menu.name), False, A(menu.name, 
_href=URL("default", "index", args=[menu.page]) ), menu_other])

    # devuelvo el list
    return menu_child


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to