##// END OF EJS Templates
Merge pull request #7196 from bfredl/asyncclient...
Merge pull request #7196 from bfredl/asyncclient KernelClient: factor out generic async client from Qt client

File last commit:

r19601:f0bcc52a
r19647:0b6cb32f merge
Show More
handlers.py
26 lines | 1018 B | text/x-python | PythonLexer
Thomas Kluyver
Refactor kernelspec resource handler to separate URL prefix
r16706 from tornado import web
from ..base.handlers import IPythonHandler
from ..services.kernelspecs.handlers import kernel_name_regex
class KernelSpecResourceHandler(web.StaticFileHandler, IPythonHandler):
SUPPORTED_METHODS = ('GET', 'HEAD')
def initialize(self):
web.StaticFileHandler.initialize(self, path='')
Thomas Kluyver
Kernel resource handlers now require authenticated user
r17007 @web.authenticated
Thomas Kluyver
Refactor kernelspec resource handler to separate URL prefix
r16706 def get(self, kernel_name, path, include_body=True):
ksm = self.kernel_spec_manager
try:
self.root = ksm.get_kernel_spec(kernel_name).resource_dir
except KeyError:
raise web.HTTPError(404, u'Kernel spec %s not found' % kernel_name)
self.log.debug("Serving kernel resource from: %s", self.root)
return web.StaticFileHandler.get(self, path, include_body=include_body)
Thomas Kluyver
Kernel resource handlers now require authenticated user
r17007
@web.authenticated
Thomas Kluyver
Refactor kernelspec resource handler to separate URL prefix
r16706 def head(self, kernel_name, path):
Thomas Kluyver
Fix HEAD requests for kernelspec resources...
r19601 return self.get(kernel_name, path, include_body=False)
Thomas Kluyver
Refactor kernelspec resource handler to separate URL prefix
r16706
default_handlers = [
(r"/kernelspecs/%s/(?P<path>.*)" % kernel_name_regex, KernelSpecResourceHandler),
]