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:
/observatories
/observatories/1
/observatories/1/telescopes
/observatories/1/telescopes/2
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:
/telescopes
/telescopes/2
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?
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
andTelescopeCollection
as well asObservatoryResource
andTelescopeResource
. I could not find a way to declare nested resources through the API, so the telescopes one above are basically done with: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 theTelescopeCollection
andTelescopeResource
, but this does not work., raising anpyramid.exceptions.ConfigurationConflictError
exception.Is this not possible? Am I supposed to declare the nested resources in the above manner?