Hi.
You can do this with the routes.py file.
Something like:
routes_in = ( ('^/([^\/]+)/?$', '/app/cont/function/$1'), )
with the patern [^\/]+ I make sure the param doesn't contain / characters.
This way if it happens that it's http://my_site/my_app/cont/func it will still
work and not redirect to that controler.
You can also use it like variable and not argument:
routes_in = ( ('^/([^\/]+)/?$', '/app/cont/function/variable=$1'), )
this way you get the param in request.vars.variable
Sorry. Didn't quite understand the second part of the question: "if 'my_page'
doesn't exist".
If you mean to redirect to another controller if parameter isn't given like:
http://my_site/
you can add another definition to routes_in, like
routes_in = ( ('^/([^\/]+)/?$', '/app/cont/function/$1'),
('^/$', '/app/other_cont/other_function/')
)
If you meant if it doesn't exist in the database or somewhere else, you can
check it in the controller and use the redirect function in the controller.
regards
mmlado
On Thursday 16 April 2009 17:07:31 Michal Jursa wrote:
> Is is possible to make somethink like:
>
> http://my_site/my_page ??
>
> Where 'my_page' will be already request.args[0] for some controller?
> Trying to figure this, but no luck. Further i'd like to redirect to
> another controller if 'my_page' doesn't exist, but this i can solve i
> think.
>
> Michal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---