Пример #1
0
 def handle_asset(self, filename):
   # TODO(wickman)  Add static_content to bottle.
   if filename in self._assets:
     mimetype, encoding = mimetypes.guess_type(filename)
     headers = {}
     if mimetype: headers['Content-Type'] = mimetype
     if encoding: headers['Content-Encoding'] = encoding
     return HTTPResponse(self._assets[filename], header=headers)
   else:
     HttpServer.abort(404, 'Unknown asset: %s' % filename)
Пример #2
0
 def handle_asset(self, filename):
   # TODO(wickman)  Add static_content to bottle.
   if filename in self._assets:
     mimetype, encoding = mimetypes.guess_type(filename)
     headers = {}
     if mimetype: headers['Content-Type'] = mimetype
     if encoding: headers['Content-Encoding'] = encoding
     return HTTPResponse(self._assets[filename], header=headers)
   else:
     HttpServer.abort(404, 'Unknown asset: %s' % filename)
Пример #3
0
 def handle_favicon(self):
   HttpServer.redirect("/assets/favicon.ico")
Пример #4
0
 def __init__(self):
   self._thread = None
   HttpServer.__init__(self)
   app.Module.__init__(self, __name__, description="Http subsystem.")
Пример #5
0
 def handle_favicon(self):
   HttpServer.redirect("/assets/favicon.ico")
Пример #6
0
 def __init__(self):
     self._thread = None
     HttpServer.__init__(self)
     app.Module.__init__(self, __name__, description="Http subsystem.")