wichert / rest_toolkit

Simple REST servers
http://rest-toolkit.rtfd.org/
BSD 2-Clause "Simplified" License
36 stars 7 forks source link

Path to resources #14

Open tholo opened 9 years ago

tholo commented 9 years ago

There is no real samples of use, so I've been trying (and failing) to figure out how one is expected to configure nested resources... For example:

So for the above I have 4 resources defined, 2 collections ObservatoryCollection and TelescopeCollection as well as ObservatoryResource and TelescopeResource. I could not find a way to declare nested resources through the API, so the telescopes one above are basically done with:

@resource(r'/observatories/{id:\d+}/telescopes')

Now I want to also access telescopes directly, like:

Figuring this would work the same as the @view_config Pyramid decorator, I optimistically just added a second @resource to the TelescopeCollection and TelescopeResource, but this does not work., raising an pyramid.exceptions.ConfigurationConflictError exception.

Is this not possible? Am I supposed to declare the nested resources in the above manner?