Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
hub-client / dockerhub / viewsets.py
Size: Mime:
"""
ViewStets to be used with V2 APIs.
"""
from rest_framework import viewsets
from rest_framework.authentication import SessionAuthentication

from dockerhub.authentication import JSONWebTokenAuthentication


class ViewSet(viewsets.ViewSet):
    """
    The base ViewSet class does not provide any actions by default.

    The only difference from this class and upstream is that it defines the
    authentication_classes to be used to limit the authentication available.

    The authentication be declared at the concrete implementation to override
    this behavior.
    """
    authentication_classes = (JSONWebTokenAuthentication, SessionAuthentication)


class GenericViewSet(viewsets.GenericViewSet):
    """
    The GenericViewSet class does not provide any actions by default,
    but does include the base set of generic view behavior, such as
    the `get_object` and `get_queryset` methods.

    The only difference from this class and upstream is that it defines the
    authentication_classes to be used to limit the authentication available.

    The authentication be declared at the concrete implementation to override
    this behavior.
    """
    authentication_classes = (JSONWebTokenAuthentication, SessionAuthentication)


class ModelViewSet(viewsets.ModelViewSet):
    """
    A viewset that provides default `create()`, `retrieve()`, `update()`,
    `partial_update()`, `destroy()` and `list()` actions.

    The only difference from this class and upstream is that it defines the
    authentication_classes to be used to limit the authentication available.

    The authentication be declared at the concrete implementation to override
    this behavior.
    """
    authentication_classes = (JSONWebTokenAuthentication, SessionAuthentication)