# Path: exactonline/exceptions.py
# class MultipleObjectsReturned(ExactOnlineError):
#     """
#     Exception named Django style.
#     """
#     pass
# 
# class ObjectDoesNotExist(ExactOnlineError):
#     """
#     Exception named Django style.
#     """
#     pass
# 
# Path: exactonline/http.py
# def binquote(value):
#     """
#     We use quote() instead of urlencode() because the Exact Online API
#     does not like it when we encode slashes -- in the redirect_uri -- as
#     well (which the latter does).
#     """
#     return quote(value.encode('utf-8'))
# 
# Path: exactonline/resource.py
# class DELETE(_Resource):
#     pass
# 
# class GET(_Resource):
#     pass
# 
# class POST(_Resource):
#     pass
# 
# class PUT(_Resource):
#     pass


from ..exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from ..http import binquote
from ..resource import DELETE, GET, POST, PUT
        api.relations.all()
    """
    resource = None  # set this in your subclass

    @classmethod
    def as_property(cls):
        @property
        def cached_getter(exactapi):
            propname = '_prop_%s' % (cls.__name__,)
            if not hasattr(exactapi, propname):
                setattr(exactapi, propname, cls(exactapi))
            return getattr(exactapi, propname)

        return cached_getter

    def __init__(self, api):
        self._api = api

    # == GET / get one / get many ==

    def all(self):
        # Select all without filtering.
        return self.filter()

    def get(self, **kwargs):
        assert 'top' not in kwargs
        ret = self.filter(top=2, **kwargs)
        if not ret:
            raise ObjectDoesNotExist()
        if len(ret) > 1:

# Path: exactonline/exceptions.py
# class MultipleObjectsReturned(ExactOnlineError):
#     """
#     Exception named Django style.
#     """
#     pass
# 
# class ObjectDoesNotExist(ExactOnlineError):
#     """
#     Exception named Django style.
#     """
#     pass
# 
# Path: exactonline/http.py
# def binquote(value):
#     """
#     We use quote() instead of urlencode() because the Exact Online API
#     does not like it when we encode slashes -- in the redirect_uri -- as
#     well (which the latter does).
#     """
#     return quote(value.encode('utf-8'))
# 
# Path: exactonline/resource.py
# class DELETE(_Resource):
#     pass
# 
# class GET(_Resource):
#     pass
# 
# class POST(_Resource):
#     pass
# 
# class PUT(_Resource):
#     pass


# Path: exactonline/api/manager.py
from ..exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from ..http import binquote
from ..resource import DELETE, GET, POST, PUT

        api.relations.all()
    """
    resource = None  # set this in your subclass

    @classmethod
    def as_property(cls):
        @property
        def cached_getter(exactapi):
            propname = '_prop_%s' % (cls.__name__,)
            if not hasattr(exactapi, propname):
                setattr(exactapi, propname, cls(exactapi))
            return getattr(exactapi, propname)

        return cached_getter

    def __init__(self, api):
        self._api = api

    # == GET / get one / get many ==

    def all(self):
        # Select all without filtering.
        return self.filter()

    def get(self, **kwargs):
        assert 'top' not in kwargs
        ret = self.filter(top=2, **kwargs)
        if not ret:
            raise ObjectDoesNotExist()
        if len(ret) > 1:

            raise MultipleObjectsReturned()