Thought I would share this piece of code I use during development to
automatically build response.menu in menu.py. It makes it easy to
navigate your site while testing. Massimo could probably rewrite this
in two lines :)
import os
from gluon.admin import apath
from gluon.myregex import regex_expose
filename = os.path.join
(request.folder,"controllers" ,request.controller + ".py")
path = apath(filename, r=request)
data = open(path, 'r').read()
functions = regex_expose.findall(data)
response.menu = [
[f.replace("_"," "), False,
URL(request.application,request.controller,f), []] for f in
functions
]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---