On Oct 1, 2010, at 9:48 AM, Francisco Costa wrote:
> 
> I would like to improve my users urls by cutting the 'view' function
> out so the url would be http://domain.com/user/username
> 
> Now I have this:
> 
> routes_in = (
>  ("/user/(.+)", r"/welcome/user/view/\1"),
>  ("/(.+)", r"/welcome/\1"),
> )
> 
> routes_out = (
>  ("/welcome/user/view/(.+)", r"/user/\1"),
>  ("/welcome/(.+)", r"/\1"),
> )
> 
> The thing is that I have more functions in the user control and they
> don't work unless I add a route for each of those functions.

Right. But as Wikus pointed out, you can do that with a single route that 
mentions those functions.

It can be easier to look at routes_out first: define how you're going to 
shorten the URLs, make sure it's unambiguous (you don't want to map multiple 
long URLs into a single short one, of course), and then write routes_in to undo 
it.

> 
> 
> On Oct 1, 5:25 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Oct 1, 2010, at 9:20 AM, Francisco Costa wrote:
>> 
>> 
>> 
>>> Has I said before, that way other functions of the controller user
>>> don't work
>> 
>> Can you list, more or less, what you're after?
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> :(
>> 
>>> On Oct 1, 3:10 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>>>> yes
>> 
>>>> routes_in = (
>>>>   ("/user/(.+)", r"/welcome/user/view/\1"),
>>>> )
>> 
>>>> routes_out = (
>>>>   ("/welcome/user/view/(.+)", r"/user/\1"),
>>>> )
>> 
>>>> On Oct 1, 8:57 am, Francisco Costa <m...@franciscocosta.com> wrote:
>> 
>>>>> is it possible?
>> 
>>>>> On Oct 1, 10:55 am, Francisco Costa <m...@franciscocosta.com> wrote:
>> 
>>>>>> Thank you for your answers, both work for me, i didn't know that the
>>>>>> order was important.
>>>>>> But the thing is that I have others functions in the user controller
>>>>>> that stopped to work, unless I have a dedicated route for them.
>>>>>> ex: /welcome/user/index is a list of all users and only works if I
>>>>>> had
>> 
>>>>>> routes_in:  ("/user/index", r"/welcome/user/index"),
>>>>>> routes_out:   ("/welcome/user/index", r"/user/index"),
>> 
>>>>>> My question is, if there is any way that you don't have to route every
>>>>>> function, and only the view/user
>> 
>>>>>> On Sep 30, 3:19 pm, Wikus van de Merwe <dupakrop...@googlemail.com>
>>>>>> wrote:
>> 
>>>>>>> You mean this doesn't work for you?
>> 
>>>>>>> routes_in = (
>>>>>>>   ("/user/(.+)", r"/welcome/user/view/\1"),
>>>>>>>   ("/(.+)", r"/welcome/\1")
>>>>>>> )
>> 
>>>>>>> routes_out = (
>>>>>>>   ("/welcome/user/view/(.+)", r"/user/\1"),
>>>>>>>   ("/welcome/(.+)", r"/\1")
>>>>>>> )


Reply via email to