1.1 --- a/WebStack/Resources/Static.py Sat Jan 14 01:52:49 2006 +0000
1.2 +++ b/WebStack/Resources/Static.py Sat Jan 14 01:53:10 2006 +0000
1.3 @@ -107,4 +107,18 @@
1.4 out.write("Resource '%s' not found." % filename)
1.5 raise EndOfResponse
1.6
1.7 +class FileResource:
1.8 +
1.9 + "A file serving resource."
1.10 +
1.11 + def __init__(self, filename, content_type):
1.12 + self.filename = filename
1.13 + self.content_type = content_type
1.14 +
1.15 + def respond(self, trans):
1.16 + trans.set_content_type(content_type)
1.17 + f = open(self.filename, "rb")
1.18 + trans.get_response_stream().write(f.read())
1.19 + f.close()
1.20 +
1.21 # vim: tabstop=4 expandtab shiftwidth=4