You can also do keeping the same notation as Django: #in routes.py routes_in=[ (r'^faq/$', 'MyView/default/url_help_faq'), (r'^faq/(?P<a>\S*)/(?P<b>\S*)', '/MyView/default/url_help_faq/$a/ $b'), ]
# in app MyView, in app controller default.py def url_help_faq(): if len(request.args) == 2: .... else: .... On Nov 20, 5:52 pm, Anthony <abasta...@gmail.com> wrote: > In the default.py controller: > > def faq(): > if len(request.args) > 1: > #perform routine extracting topic0100 and faq0100 > #topic0100 will be in request.args(0), and faq0100 will be in > request.args(1) > else: > #perform default routine > > Note, by default, that will give you a url > likehttp://www.mysite.com/appname/default/faq/topic0100/faq0100, but you can > easily remove /appname/default from the URL using routes.py > (seehttp://web2py.com/book/default/chapter/04#Parameter-Based-System). In > routes.py: > > routers = dict( > BASE = dict( > default_application = 'appname', > default_controller='default' > ), > ) > > Anthony > > > > > > > > On Sunday, November 20, 2011 5:53:50 PM UTC-5, Constantine Vasil wrote: > > > I have in Django urls these statements: > > > (r'^faq/$', 'MyView.views.url_help_faq'), > > (r'^faq/(\S*)/(\S*)', 'MyView.views.url_help_faq'), > > > Which is making possible *MyView.views.url_help_faq* > > to serve the following requests: > > >http://www.MySite.com/faq > >http://www.MySite.com/faq/topic0100/faq0100 > > > def url_help_faq(request, topic=None, faq=None): > > > if not topic and not faq: > > #perform default routine > > > if topic and faq: > > #perform routine extracting topic0100 and faq0100 > > > return topic, faq > > > How to make this in web2py?