This was added to avoid repeating the route path prefix for
subresources like /users/1/photos.
Here is an example (from the docs):
from rest_toolkit import resource
PHOTOS = {1: ['...']}
@resource('/users/{id}')
class User(object):
def __init__(self, request):
self.user_id = int(request.matchdict['id'])
@User.resource('/photos')
class UserPhotos(User):
pass
@UserPhotos.GET()
def get_user_photos(resource, request):
return PHOTOS.get(resource.user_id, [])
Do you think this is a good idea or no? I think the subclassing should still
be explicit for clarity. If you like the change I would add a test and docs.
This was added to avoid repeating the route path prefix for subresources like /users/1/photos.
Here is an example (from the docs):
Do you think this is a good idea or no? I think the subclassing should still be explicit for clarity. If you like the change I would add a test and docs.