List Info

Thread: RESTful dispatch question




RESTful dispatch question
country flaguser name
United States
2007-05-25 11:51:40
I've been looking at RESTful dispatch tools for use with CP
and I'm not seeing 
any that will dispatch where you have multiple parameters in
the URL, like 
/Y/M/D in the following (consider that /M/D are optional as
well!):

/posts/Y/M/D/user/ID

Everything I'm seeing expects there to be only one
parameter.  This would work 
for most of the cases but there will be exceptions.

There's a Selector module that works with WSGI applications
that will handle 
this just great but using it inside CP looks like you'd have
to write a 
straight WSGI application and lose functionality provided by
CP as a result 
(i.e. logging, etc.)

It appears from my limited look so far at WSGI that you have
to get modules to 
do everything (i.e. paste.translogger for logging) and you
end up gluing a 
bunch of stuff together that CP already supplies.

How do you deal with this situation?

Scott

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: RESTful dispatch question
user name
2007-05-25 12:03:59
On 5/25/07, Scott Chapman <scott_listmischko.com> wrote:
>
> I've been looking at RESTful dispatch tools for use
with CP and I'm not seeing
> any that will dispatch where you have multiple
parameters in the URL, like
> /Y/M/D in the following (consider that /M/D are
optional as well!):
>
> /posts/Y/M/D/user/ID
>
> Everything I'm seeing expects there to be only one
parameter.  This would work
> for most of the cases but there will be exceptions.

Well, you can handle those URLs directly with CP using the
default method:
http://cherrypy.org/wiki/CherryPyTuto
rial#Partialmatchesandthedefaultmethod

If that isn't enough, you can used the provided Routes
dispatcher or
the HTTP MethodDispatcher.
htt
p://cherrypy.org/wiki/PageHandlers#Dispatchers

> There's a Selector module that works with WSGI
applications that will handle
> this just great but using it inside CP looks like you'd
have to write a
> straight WSGI application and lose functionality
provided by CP as a result
> (i.e. logging, etc.)

If you would like to use Selector, perhaps it could be
hooked up to
CherryPy as a custom dispatcher, like the one for Routes. 
That would
be a welcome contribution to the collection of code at
tools.cherrypy.org.

> It appears from my limited look so far at WSGI that you
have to get modules to
> do everything (i.e. paste.translogger for logging) and
you end up gluing a
> bunch of stuff together that CP already supplies.

Yes, WSGI itself is really something that the application
developer
shouldn't have to deal with on a high level.  It is useful
for
framework/tool authors though.

HTH,

Christian
http://www.dowski.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )