Esempio n. 1
0
    def get_document_method(self):
        """Return everything you need to call an document method.

        Returns:
            A three-tuple of:
                * document object
                * method name
                * method object

        Raises:
            EndpointError if the method or document is not found or the method is not exposable.
        """

        obj = self.get_document()
        if obj is None:
            obj = self.get_collection().document_class

        method = getattr(obj, self.doc_method, None)
        if not method:
            raise EndpointError("{0} is not a method of {1}".format(
                                        self.doc_method, self.app))
        if is_exposed(method):
            return method
        else:
            raise EndpointError("{0} is not an exposable method on {1}".format(
                                        self.doc_method, self.app))
Esempio n. 2
0
    def get_document_method(self):
        """Return everything you need to call an document method.

        Returns:
            A three-tuple of:
                * document object
                * method name
                * method object

        Raises:
            EndpointError if the method or document is not found or the method is not exposable.
        """

        obj = self.get_document()
        if obj is None:
            obj = self.get_collection().document_class

        method = getattr(obj, self.doc_method, None)
        if not method:
            raise EndpointError("{0} is not a method of {1}".format(
                self.doc_method, self.app))
        if is_exposed(method):
            return method
        else:
            raise EndpointError("{0} is not an exposable method on {1}".format(
                self.doc_method, self.app))
Esempio n. 3
0
    def get_collection_method(self):
        """Return everything you need to call an collection method.

        Returns:
            A three-tuple of:
                * collection object
                * method name
                * method object

        Raises:
            EndpointError if the method or collection is not found or the method is not exposable.
        """

        obj = self.get_collection()
        method = getattr(obj, self.coll_method, None)
        if not method:
            raise EndpointError("{0} is not a method of {1}".format(
                                        self.coll_method, self.app))
        if is_exposed(method):
            return method
        else:
            raise EndpointError("{0} is not an exposable method on {1}".format(
                                        self.coll_method, self.app))
Esempio n. 4
0
    def get_collection_method(self):
        """Return everything you need to call an collection method.

        Returns:
            A three-tuple of:
                * collection object
                * method name
                * method object

        Raises:
            EndpointError if the method or collection is not found or the method is not exposable.
        """

        obj = self.get_collection()
        method = getattr(obj, self.coll_method, None)
        if not method:
            raise EndpointError("{0} is not a method of {1}".format(
                self.coll_method, self.app))
        if is_exposed(method):
            return method
        else:
            raise EndpointError("{0} is not an exposable method on {1}".format(
                self.coll_method, self.app))