From 0a430f5840c2c0cd125374e874e6bec16055798d Mon Sep 17 00:00:00 2001 From: Konrad Hinsen Date: Mon, 10 Feb 2014 17:07:37 +0100 Subject: [PATCH] Add method notebook_exists to NotebookManager. It is called by IPython.html.notebook.NotebookHandler.get, so it must be implemented by every notebook handler. --- IPython/html/services/notebooks/nbmanager.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/IPython/html/services/notebooks/nbmanager.py b/IPython/html/services/notebooks/nbmanager.py index 3efd72544..b2b87165c 100644 --- a/IPython/html/services/notebooks/nbmanager.py +++ b/IPython/html/services/notebooks/nbmanager.py @@ -129,6 +129,22 @@ class NotebookManager(LoggingConfigurable): """ return basename + def notebook_exists(self, name, path=''): + """Returns a True if the notebook exists. Else, returns False. + + Parameters + ---------- + name : string + The name of the notebook you are checking. + path : string + The relative path to the notebook (with '/' as separator) + + Returns + ------- + bool + """ + raise NotImplementedError('must be implemented in a subclass') + # TODO: Remove this after we create the contents web service and directories are # no longer listed by the notebook web service. def list_dirs(self, path):