コード例 #1
0
ファイル: schema.py プロジェクト: biosustain/potion
    def format_response(self, response):
        """
        Takes a response value, which can be a ``data`` object or a tuple ``(data, code)`` or ``(data, code, headers)``
        and formats it using :meth:`format`.

        :param response: A response tuple.
        :return: A tuple in the form ``(data, code, headers)``
        """
        data, code, headers = unpack(response)
        # TODO omit formatting on certain codes.
        return self.format(data), code, headers
コード例 #2
0
    def format_response(self, response):
        """
        Takes a response value, which can be a ``data`` object or a tuple ``(data, code)`` or ``(data, code, headers)``
        and formats it using :meth:`format`.

        :param response: A response tuple.
        :return: A tuple in the form ``(data, code, headers)``
        """
        data, code, headers = unpack(response)
        # TODO omit formatting on certain codes.
        return self.format(data), code, headers