If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

Just replace the existing response.menu assignment in menu.py (in the models folder) with this...

import os
from gluon.myregex import regex_expose
ctldir = os.path.join(request.folder,"controllers")
ctls=os.listdir(ctldir)
if 'appadmin.py' in ctls: ctls.remove('appadmin.py')
response.menu = []
for ctl in ctls:
    if ctl.endswith(".bak") == False:
        filename = os.path.join(ctldir,ctl)
        data = open(filename, 'r').read()
        functions = regex_expose.findall(data)
        ctl = ctl[:-3].replace("_"," ")
        response.menu.append([ctl.capitalize(), False, '#',
            [[f.replace("_"," ").capitalize(), False,URL(request.application,ctl,f)] for f in functions]])

Related slices

Comments (0)


Hosting graciously provided by:
Python Anywhere