##// END OF EJS Templates
handle single static path in FileFindHandler
MinRK -
Show More
@@ -749,6 +749,8 b' class FileFindHandler(web.StaticFileHandler):'
749 _static_paths = {}
749 _static_paths = {}
750
750
751 def initialize(self, path, default_filename=None):
751 def initialize(self, path, default_filename=None):
752 if isinstance(path, basestring):
753 path = [path]
752 self.roots = tuple(
754 self.roots = tuple(
753 os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in path
755 os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in path
754 )
756 )
@@ -849,14 +851,16 b' class FileFindHandler(web.StaticFileHandler):'
849 could be determined.
851 could be determined.
850 """
852 """
851 # begin subclass override:
853 # begin subclass override:
852 static_path = settings['static_path']
854 static_paths = settings['static_path']
855 if isinstance(static_paths, basestring):
856 static_paths = [static_paths]
853 roots = tuple(
857 roots = tuple(
854 os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in static_path
858 os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in static_paths
855 )
859 )
856
860
857 try:
861 try:
858 abs_path = filefind(path, roots)
862 abs_path = filefind(path, roots)
859 except Exception:
863 except IOError:
860 logging.error("Could not find static file %r", path)
864 logging.error("Could not find static file %r", path)
861 return None
865 return None
862
866
@@ -155,7 +155,7 b' class NotebookWebApplication(web.Application):'
155
155
156 settings = dict(
156 settings = dict(
157 template_path=os.path.join(os.path.dirname(__file__), "templates"),
157 template_path=os.path.join(os.path.dirname(__file__), "templates"),
158 static_path=os.path.join(os.path.dirname(__file__), "static"),
158 static_path=ipython_app.static_file_path,
159 static_handler_class = FileFindHandler,
159 static_handler_class = FileFindHandler,
160 cookie_secret=os.urandom(1024),
160 cookie_secret=os.urandom(1024),
161 login_url="%s/login"%(base_project_url.rstrip('/')),
161 login_url="%s/login"%(base_project_url.rstrip('/')),
General Comments 0
You need to be logged in to leave comments. Login now