Re: MethodDispatcher and overloading

David Allouche <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
> On 2 May 2016, at 16:35, Aaron Dalton <[email protected]> wrote:
> 
> So I'm using MethodDispatcher but I need to handle two different forms of a specific GET request (with different parameter sets). I did two different GET functions with different signatures, but that didn't work. So then I removed all arguments and tried to use "fields.get()", but the request fails because it can't find a GET with a matching signature. What's the right way to do overloading with MethodDispatcher?

Set the method signature to:
def method(self, *args, **kwargs):

*args gives you the additional path elements.

**kwargs gives you query arguments and post data, also accessible from cherrypy.request.params.

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.