On 9/6/06, Arnar Birgisson <[EMAIL PROTECTED]> wrote:
>
> @expose("json")
> def callapi(self, method, *args, **kwargs):
>     try:
>         m = getattr(self, method)
>         return m(*args, **kwargs)
>     except (AttributeError, TypeError):
>         raise cherrypy.NotFound()
>
> and changed my Rotes connect from
> m.connect('api/pe/:jobno/:pagename/:action', controller='pageeditor')
> to
> m.connect('api/pe/:jobno/:pagename/:method', controller='pageeditor',
> action='callapi')
>
> Now my api methods can happily call each other without problem since
> all web requests go through callapi.
>

I was going to suggest a very similar method that I wrote up a few weeks ago.

http://www.splee.co.uk/2006/08/14/custom-dispatcher-in-cherrypy/

It achives much the same thing in a slightly different way.

Lee

-- 
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to