Package brisa :: Package core :: Module webserver :: Class StaticFile
[hide private]
[frames] | no frames]

Class StaticFile

source code

object --+
         |
        StaticFile

Object that matches with a file and makes it available on the server.

Instance Methods [hide private]
 
__init__(self, name, path, content_type=None, disposition=None)
Constructor for the StaticFile class.
source code
 
_guess_content_type(self)
Guesses content type for this file based on the filename.
source code
 
application(self, environ, start_response, response=None)
Application wsgi callback that processes a request.
source code
 
render(self, uri, request, response)
Enables the file to receive an URL redirection, that is, a resource can return this file on the get_render() method.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, path, content_type=None, disposition=None)
(Constructor)

source code 

Constructor for the StaticFile class.

Parameters:
  • name - file name visible on the webserver
  • path - file path on the system
  • content_type - force content type, e.g. "application/x-download"
  • disposition - file disposition, e.g. "attachment"
Overrides: object.__init__

Note: path supplied must exist and point to a file

_guess_content_type(self)

source code 

Guesses content type for this file based on the filename.

Copyright (c) 2002-2008, CherryPy Team (team@cherrypy.org)

application(self, environ, start_response, response=None)

source code 

Application wsgi callback that processes a request. Must not be called by the user.

Parameters:
  • response - used when the request was redirected to this file. If not present, then this file was accessed directly (no redirections) and in this case environ and start_response must be passed accordingly.