]>
jfr.im git - irc/quakenet/qwebirc.git/blob - qwebirc/engines/staticengine.py
1 from twisted
.web
import resource
, server
, static
, error
2 from qwebirc
.util
.gziprequest
import GZipRequest
3 import qwebirc
.util
as util
5 from adminengine
import AdminEngineAction
7 # TODO, cache gzip stuff
13 def apply_gzip(request
):
14 accept_encoding
= request
.getHeader('accept-encoding')
16 encodings
= accept_encoding
.split(',')
17 for encoding
in encodings
:
18 name
= encoding
.split(';')[0].strip()
20 request
= GZipRequest(request
)
23 class StaticEngine(static
.File
):
25 hit
= util
.HitCounter()
27 def __init__(self
, *args
, **kwargs
):
28 static
.File
.__init
__(self
, *args
, **kwargs
)
30 def render(self
, request
):
32 request
= apply_gzip(request
)
33 return static
.File
.render(self
, request
)
36 def adminEngine(self
):
39 #("Contents: %s" % pprint.pformat(list(cache.keys())),)# AdminEngineAction("clear", d))
46 def directoryListing(self
):
47 return error
.ForbiddenResource()