On Fri, Oct 23, 2009 at 2:48 PM, d2ncal <[email protected]> wrote:

However, to get the above working, I will have to change the
> declaration of view() action in profile controller to accept username
> as an argument. It already check for username in 'GET'. I want to keep
> the old method working along with the new method.
>
> Is there any way I can get routes to convert the request to a GET
> based URL, rather than explicitly passing the argument to view
> function?
>

Not sure if routes can do that for you, but what you can do is add another
action to your controller class that does NOT return a response, but merely
calls the right action:

def view(self, username):
    # whatever you do normally

and:

def legacy_view(self):
     # put some checking here, send 404 if bad...
     un = params.get('username')
     return self.view(un)

Then you can map

http://mysite.com/profile/view?user=username

to the legacy_view in routes.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to