On Wed, Nov 12, 2008 at 2:00 AM, mario ruggier <[EMAIL PROTECTED]> wrote:
>
> I would like to support specific http verbs on a given URI. For example, to
> support GET and PUT for the URI /controller/action/id I have defined these
> 2 dedicated routes:
>
>    map.connect('/controller/action/:id', controller='controller',
>        action='GET_action', conditions=dict(method=['GET']))
>    map.connect('/controller/action/:id', controller='controller',
>        action='PUT_action', conditions=dict(method=['PUT']))
>
> Issuing a GET or PUT for this (same) URI will cause the correct action to
> be executed... however, if I issue a request with a different method, such
> as a POST, the response is a 500 Internal Server Error. I would have
> expected a 404 Not Found, as is normally returned for "no matching route".
>
> A simple workaround (amongst other more elaborate -- and imho more
> convoluted -- local dispatching mechanisms) is to follow up the above
> routes with a catchall for the any other verbs:
>
>    map.connect('/controller/action/:id', controller='controller',
>        action='OTHER_action')
>
> that would then be supplied as a method on controller simply to return 404:
>
>    def OTHER_action(self, id):
>        abort(404)
>
> So, why the 500 and not the 404 in the first place?
> Any other suggestions of how best to handle such situations?

It should be 404 and it usually is.  There must be a bug in how it
processes the particular argument combination.  What happens if you
comment out the second route and remove the condition in the first?

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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