コード例 #1
0
ファイル: file.py プロジェクト: krallin/Cactus
    def content_type(self):
        """
        Return the content type for this object
        """
        content_type = mime.guess(self.path)

        if not content_type:
            return None

        if content_type == "text/html":
            content_type = "{0}; charset=utf-8".format(content_type)

        return content_type
コード例 #2
0
    def content_type(self):
        """
        Return the content type for this object
        """
        content_type = mime.guess(self.path)

        if not content_type:
            return None

        if content_type == "text/html":
            content_type = "{0}; charset=utf-8".format(content_type)

        return content_type
コード例 #3
0
ファイル: file.py プロジェクト: beaufour/Cactus
    def content_type(self):
        """
        Return the content type for this object
        """

        # beaufour: total hack to support my paths without ending /
        if self.path is None or self.path.find('.') == -1:
            content_type = "text/html"
        else:
            content_type = mime.guess(self.path)

        if not content_type:
            return None

        if content_type == "text/html":
            content_type = "{0}; charset=utf-8".format(content_type)

        return content_type
コード例 #4
0
 def test_mime_eot(self):
     font_path = "test/font.eot"
     self.assertFalse(guess(font_path) is None)
コード例 #5
0
 def test_mime_dummy(self):
     # Make sure we never return a None mime type!
     path = "test/format.thisisnomime"
     self.assertFalse(guess(path) is None)
コード例 #6
0
ファイル: test_mime.py プロジェクト: ateszdn/Cactus
 def test_mime_eot(self):
     font_path = "test/font.eot"
     self.assertFalse(guess(font_path) is None)
コード例 #7
0
ファイル: test_mime.py プロジェクト: ateszdn/Cactus
 def test_mime_dummy(self):
     # Make sure we never return a None mime type!
     path = "test/format.thisisnomime"
     self.assertFalse(guess(path) is None)
コード例 #8
0
ファイル: server.py プロジェクト: vbrilon/Cactus
 def get(self):
     self.set_header("Content-Type", mime.guess("file.js"))
     self.finish(TEMPLATES["js"])
コード例 #9
0
ファイル: server.py プロジェクト: vbrilon/Cactus
 def get_content_type(self):
     return mime.guess(self.absolute_path)
コード例 #10
0
ファイル: server.py プロジェクト: dahrens/Cactus
 def get(self):
     self.set_header("Content-Type", mime.guess("file.js"))
     self.finish(TEMPLATES["js"])
コード例 #11
0
ファイル: server.py プロジェクト: dahrens/Cactus
 def get_content_type(self):
     return mime.guess(self.absolute_path)