[web2py] routes.py in case of second application.
In my application every registered user has a shortname stored in auth_user, which he can use to reference his home page. For this purpose I have the following code in 00_db.py: if request.controller == 'default' and request.function == 'index' and request.args(0) == 'nl': row=db(db.auth_user.shortname==request.args(1)).select(db.auth_user.nodeID).first() ## check the db and do a redirect if row: redirect(URL('addressbook','router',args=row.nodeID)) else: session.flash='Shortname unknown' redirect(URL('addressbook','index')) ... and in routes.py in the root /web2py folder: routers = dict( BASE = dict( default_application = 'init', applications = 'ALL', default_controller = 'default', controllers = 'DEFAULT', default_function = 'index', ), init = dict( default_function = 'index', functions = ['index','user','register','download','call','data','error'] ) ) For demo purposes I'd like to make a copy of part of my init application, call it demo and have it connect to a different database, which I can use freely to insert demo records. How do I have to adjust routes.py to make this work, just add: demo= dict( default_function = 'index', functions = ['index','user','download','call','data','error'] ) ... or do I need to make more adjustments? Kind regards, Annet. -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] routes.py in case of second application.
On 29 Jan 2013, at 1:44 AM, Annet anneve...@googlemail.com wrote: In my application every registered user has a shortname stored in auth_user, which he can use to reference his home page. For this purpose I have the following code in 00_db.py: if request.controller == 'default' and request.function == 'index' and request.args(0) == 'nl': row=db(db.auth_user.shortname==request.args(1)).select(db.auth_user.nodeID).first() ## check the db and do a redirect if row: redirect(URL('addressbook','router',args=row.nodeID)) else: session.flash='Shortname unknown' redirect(URL('addressbook','index')) ... and in routes.py in the root /web2py folder: routers = dict( BASE = dict( default_application = 'init', applications = 'ALL', default_controller = 'default', controllers = 'DEFAULT', default_function = 'index', ), init = dict( default_function = 'index', functions = ['index','user','register','download','call','data','error'] ) ) For demo purposes I'd like to make a copy of part of my init application, call it demo and have it connect to a different database, which I can use freely to insert demo records. How do I have to adjust routes.py to make this work, just add: demo= dict( default_function = 'index', functions = ['index','user','download','call','data','error'] ) ... or do I need to make more adjustments? I think that's all you need. -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.