Esempio n. 1
0
    def body(self, val):

        """
        If the body isn't wrapped in a list, I'll wrap it in a list.
        """

        self._body = clepy.listmofize(val)
Esempio n. 2
0
    def body_python3(self, val):

        """
        If the body isn't wrapped in a list, I'll wrap it in a list.

        (Only if it's not a file wrapper)
        """

        from gunicorn.http.wsgi import FileWrapper

        if isinstance(val, FileWrapper):
            self._body = val

        # Remember that in python 3, unicode stuff is just a string.
        elif isinstance(val, str):
            self._body = clepy.listmofize(bytes(val, "utf-8"))

        else:
            self._body = clepy.listmofize(val)
Esempio n. 3
0
    def body(self, val):

        """
        If the body isn't wrapped in a list, I'll wrap it in a list.

        (Only if it's not a file wrapper)
        """

        from gunicorn.http.wsgi import FileWrapper

        if not isinstance(val, FileWrapper):
            self._body = clepy.listmofize(val)
        else:
            self._body = val
Esempio n. 4
0
    def body_python2(self, val):

        """
        This is the body setter for python 2.

        If the body isn't wrapped in a list, I'll wrap it in a list, but
        only if the data is not a file wrapper!
        """

        from gunicorn.http.wsgi import FileWrapper

        if not isinstance(val, FileWrapper):
            self._body = clepy.listmofize(val)
        else:
            self._body = val