Adding service to virtual path
I'm trying to add a single service to a virtual path like http://localhost:8080/geospatial/geocoder/XMLRPC.
Version info:
Twisted: 9.0
Python: 2.6
The following code does not work:
root = resource.Resource()
srv = XMLRPCGeocoder()
root.putChild("geospatial/geocoder/XMLRPC", srv)
When I attempt to access the service, twisted gives the following error:
Request failed:
On Thu, Oct 21, 2010 at 01:17:36PM -0700, Eric Chamberlain wrote:
I'm trying to add a single service to a virtual path like http://localhost:8080/geospatial/geocoder/XMLRPC.
Version info: Twisted: 9.0 Python: 2.6
The following code does not work:
root = resource.Resource() srv = XMLRPCGeocoder() root.putChild("geospatial/geocoder/XMLRPC", srv)
When I attempt to access the service, twisted gives the following error: Request failed:
You should put a resource for each component of the url: root = resource.Resource() geospatial = resource.Resource() root.putChild('geospatial', geospatial) geocoder = resource.Resource() geospatial.putChild('geocoder', geocoder) xmlrpc = XMLRPCGeocoder() geocoder.putChild('XMLRPC', xmlrpc) I didn't double checked, but I am pretty sure that this will works.
Looking at twisted.web.resource.Resource's source code, all it does is add the path to a hash array and returns nothing...
Yes, putChild does this, but this is not how path traversal works. The path is splitted in segments which are harvested one after the other until a resource is returned. m. -- Dalle virtù che si esigono in un domestico, l'Eccellenza Vostra conosce molti padroni degni d'esser servitori? -- Pierre Augustin Caron de Beaumarchais
That was it. If you lived near by I'd buy you a beer. Thank you!
On Oct 21, 2010, at 1:47 PM, Marco Giusti wrote:
On Thu, Oct 21, 2010 at 01:17:36PM -0700, Eric Chamberlain wrote:
I'm trying to add a single service to a virtual path like http://localhost:8080/geospatial/geocoder/XMLRPC.
Version info:
Twisted: 9.0
Python: 2.6
The following code does not work:
root = resource.Resource()
srv = XMLRPCGeocoder()
root.putChild("geospatial/geocoder/XMLRPC", srv)
When I attempt to access the service, twisted gives the following error:
Request failed:
On Thu, Oct 21, 2010 at 02:20:41PM -0700, Eric Chamberlain wrote:
That was it. If you lived near by I'd buy you a beer. Thank you!
I appreciate the thought. :) m. -- Cosa volete? Questo diavolo d'uomo ha sempre le tasche ripiene di argomenti irresistibili. -- Pierre Augustin Caron de Beaumarchais
participants (2)
-
Eric Chamberlain
-
Marco Giusti