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 like 
http://www.mysite.com/appname/default/faq/topic0100/faq0100, but you can 
easily remove /appname/default from the URL using routes.py 
(see http://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?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Reply via email to