[Twisted-web] Leaf Resources with child Leaf Resources

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Feb 29 12:27:05 EST 2012

On 05:05 pm, jacek99 at gmail.com wrote:
>> From what I understand, once a Resource isLeaf = True, it cannot have 
>Resources of its own (no requests seem to get routed to them).
>This is not really a realistic scenario in a typical REST application 
>nested REST services are common, e.g.

Sorry, perhaps it would be obvious if I looked at the CorePost 
implementation or read its documentation, but I don't understand what 
problem you're having or what question you're asking.

If setting `isLeaf` to `True` isn't appropriate for CorePost's purposes, 
then don't set it to `True`?

>Customer REST service:
>*GET /services/customer*
>*POST /services/customer*
>*PUT /services/customer/<customerId>*
>*DELETE /services/customer/<customerId>*
>Customer Address REST service:
>*GET /services/customer/<customerId>/address*
>*POST /services/customer/<customerId>/address*
>*PUT /services/customer/<customerId>/address/<addressId>*
>*DELETE /services/customer/<customerId>/address/<addressId>*
>and so on and so forth....
>The only way I can support this in CorePost is to separate the concept 
>of a
>Twisted.Web Resource from a standalone REST service for a particular 
>So let's say I would have a root CorePost Resource hooked up to 
>and it would have a child collection of REST service classes and manage
>routing the requests
>to the appropriate one. Each of the REST services for an entity 
>that core Resource would NOT be a twisted.web Resource but just a 
>Does this sound correct?
>Or am I missing some way of using twisted.web Resource objects that 
>allow me to accomplish the same thing without moving away from Resource
>as the ancestor of all my REST service classes?

More information about the Twisted-web mailing list