def static(self, filepath):
        """Returns static content from within our gzip-compressed tar file.

        For this example, here's the theoretical layout of static.tar.gz:
        $ tar -ztvf static.tar.gz
        drwxr-xr-x user/staff     0 2008-12-22 22:48 html/
        -rw-r--r-- user/staff  1922 2008-12-22 22:43 html/index.html
        -rw-r--r-- user/staff   200 2008-12-22 22:43 css/default.css
        drwxr-xr-x user/staff     0 2008-12-22 22:48 images/
        -rw-r--r-- user/staff  1432 2008-12-22 22:43 images/logo.gif
        ...and index.html loads both css/default.css and images/logo.gif
        """
        tar = tarfile.open(tarball_path)
        fileobj = tar.extractfile(filepath)
        f, extension = os.path.splitext(filepath)
        if extension == '.css': # It seems CherryPy can't always figure out what mime types are inside tarballs
            cherrypy.response.headers['Content-Type'] = "text/css"
        filedata = fileobj.read()
        return filedata
Returns static content from within our gzip-compressed tar file.

        For this example, here's the theoretical layout of static.tar.gz:
        $ tar -ztvf static.tar.gz
        drwxr-xr-x user/staff     0 2008-12-22 22:48 html/
        -rw-r--r-- user/staff  1922 2008-12-22 22:43 html/index.html
        -rw-r--r-- user/staff   200 2008-12-22 22:43 css/default.css
        drwxr-xr-x user/staff     0 2008-12-22 22:48 images/
        -rw-r--r-- user/staff  1432 2008-12-22 22:43 images/logo.gif
        ...and index.html loads both css/default.css and images/logo.gif
        
recipes/Python/576706_Serve_static_web_content_withgzipped_tarball/recipe-576706.py