[Twisted-web] Leaf Resources with child Leaf Resources

Jacek Furmankiewicz jacek99 at gmail.com
Wed Feb 29 16:00:57 EST 2012


OK, so the issue I have is that I cannot create two separate REST Resources
with nested URLs  e.g.

class CustomerRestService(Resource):
     """Handles REST operations for Customer /customer"""
     pass

class CustomerAddressRestService(Resource):
     """Handles REST operations for Customer Address
/customer/<customerId>/address"""
     pass

Instead I would need to have one common Resource that handles everything
under '/customer',
including the customer entity and customer address entity in one (and any
other entity whose root is '/customer').

That isn't a very good design...especially if you maybe have 50 different
entities hooked up  under '/customer' (like in our app).
It seems in order to enable having nice cohesive classes that provide a
REST service for just one entity I would need to manually
route the request from the root Resource into each of them myself.

That is what i was trying to avoid, but it looks like there is no other
choice.

Jacek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20120229/7e95c776/attachment-0001.htm 


More information about the Twisted-web mailing list