OK. email me the patch. Massimo
On Apr 6, 2:09 pm, Robin B <robi...@gmail.com> wrote: > I thought it would be cool to have a routes.py for each application, > so I put the following in web2py/routes.py, which combines the routes > from each application/*/routes.py at boot time. > > web2py/routes.py: > > from gluon.fileutils import listdir > import os,glob > apps_with_routes = [] > app_routes = glob.glob('applications/*/routes.py') > for ar in app_routes: > dir,r = os.path.split(ar) > dir,app = os.path.split(dir) > apps_with_routes.append(app) > > routes_in_list = routes_out_list = [] > for app in apps_with_routes: > module_name = 'applications.%s.routes' % app > m = __import__(module_name,globals(),locals(),['']) > routes_in_list.extend(list(m.routes_in)) > routes_out_list.extend(list(m.routes_out)) > > routes_in=set(routes_in_list) > routes_out=set(routes_out_list) > > applications/welcome/routes.py: > > app = 'welcome' > con = 'default' > main = (app,con) > > routes_in=( > ('/','/%s/%s/index' % main), # homepage > ) > routes_out = [(x,y) for (y,x) in routes_in] > > Using an approach like this allows you to distribute a routes.py with > your application code. > > Robin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---