diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index 6061380..d4ab4a1 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -749,6 +749,8 @@ class FileFindHandler(web.StaticFileHandler): _static_paths = {} def initialize(self, path, default_filename=None): + if isinstance(path, basestring): + path = [path] self.roots = tuple( os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in path ) @@ -849,14 +851,16 @@ class FileFindHandler(web.StaticFileHandler): could be determined. """ # begin subclass override: - static_path = settings['static_path'] + static_paths = settings['static_path'] + if isinstance(static_paths, basestring): + static_paths = [static_paths] roots = tuple( - os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in static_path + os.path.abspath(os.path.expanduser(p)) + os.path.sep for p in static_paths ) try: abs_path = filefind(path, roots) - except Exception: + except IOError: logging.error("Could not find static file %r", path) return None diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 4cc7fd2..1a300b8 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -155,7 +155,7 @@ class NotebookWebApplication(web.Application): settings = dict( template_path=os.path.join(os.path.dirname(__file__), "templates"), - static_path=os.path.join(os.path.dirname(__file__), "static"), + static_path=ipython_app.static_file_path, static_handler_class = FileFindHandler, cookie_secret=os.urandom(1024), login_url="%s/login"%(base_project_url.rstrip('/')),