Exemplo n.º 1
0
 def orig__call__(self, request):
     contents = htmltext('')
     if self.mime_type == 'text/html':
         file_name = request.get_path()[1:]     # drop leading '/'
         contents += header(get_title_from_path(file_name))
         contents += htmltext(StaticFile.__call__(self, request))
         contents += footer()
     return contents
Exemplo n.º 2
0
 def orig__call__(self, request):
     contents = htmltext('')
     if self.mime_type == 'text/html':
         file_name = request.get_path()[1:]  # drop leading '/'
         contents += header(get_title_from_path(file_name))
         contents += htmltext(StaticFile.__call__(self, request))
         contents += footer()
     return contents
Exemplo n.º 3
0
 def __call__(self, req):
     # Add an ETag header for better caching.
     response = quixote.get_response()
     stat = os.stat(self.path)
     goo=str(stat.st_mtime)+self.path
     response.set_header('ETag', sha.sha(goo).digest().encode('hex'))
     
     return StaticFile.__call__(self)
Exemplo n.º 4
0
 def __call__(self, request):
     r = TemplateIO(html=0)
     file_name = request.get_path()[1:]     # drop leading '/'
     r += header(get_title_from_path(file_name))
     body = StaticFile.__call__(self, request)
     if isinstance(body, Stream):
         for hunk in body:
             r += hunk
     else:
         r += body
     r += footer()
     return r.getvalue()
Exemplo n.º 5
0
 def __call__(self, request):
     r = TemplateIO(html=0)
     file_name = request.get_path()[1:]  # drop leading '/'
     r += header(get_title_from_path(file_name))
     body = StaticFile.__call__(self, request)
     if isinstance(body, Stream):
         for hunk in body:
             r += hunk
     else:
         r += body
     r += footer()
     return r.getvalue()