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 web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to