Kinto-Core maps URLs, endpoints
and permissions
to resources using ViewSets.
Since a resource defines two URLs with several HTTP methods, a view set can be considered as a set of rules for registring the resource views into the routing mechanism of Pyramid.
To use Kinto-Core in a basic fashion, there is no need to understand how viewsets work in full detail.
Viewsets defaults can be overriden by passing arguments to the kinto.core.resource.register
class decorator:
from kinto.core import resource
@resource.register(collection_methods=('GET',))
class Resource(resource.UserResource):
mapping = BookmarkSchema()
In case this isn't enough, the kinto.core.resource.viewset.ViewSet
class can be subclassed and specified during registration:
from kinto.core import resource
class NoSchemaViewSet(resource.ViewSet):
def get_record_schema(self, resource_cls, method):
simple_mapping = colander.MappingSchema(unknown='preserve')
return simple_mapping
@resource.register(viewset=NoSchemaViewSet())
class Resource(resource.UserResource):
mapping = BookmarkSchema()
kinto.core.resource.viewset.ViewSet
kinto.core.resource.viewset.ShareableViewSet