From 031cdc52d2a78af7ef439dc4080f94b90867e69a 2011-12-18 02:12:41 From: Fernando Perez Date: 2011-12-18 02:12:41 Subject: [PATCH] Define flags in application that's going to use them. --- diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 2c27273..49132ec 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -50,9 +50,9 @@ from .handlers import (LoginHandler, LogoutHandler, MainKernelHandler, KernelHandler, KernelActionHandler, IOPubHandler, ShellHandler, NotebookRootHandler, NotebookHandler, RSTHandler ) -from .notebookmanager import NotebookManager, manager_flags +from .notebookmanager import NotebookManager -from IPython.config.application import catch_config_error +from IPython.config.application import catch_config_error, boolean_flag from IPython.core.application import BaseIPythonApplication from IPython.core.profiledir import ProfileDir from IPython.lib.kernel import swallow_argv @@ -157,12 +157,15 @@ flags['read-only'] = ( """ ) -flags.update(manager_flags) +# Add notebook manager flags +flags.update(boolean_flag('script', 'NotebookManager.save_script', + 'Auto-save a .py script everytime the .ipynb notebook is saved', + 'Do not auto-save .py scripts for every notebook')) # the flags that are specific to the frontend # these must be scrubbed before being passed to the kernel, # or it will raise an error on unrecognized flags -notebook_flags = ['no-browser', 'no-mathjax', 'read-only', 'script'] +notebook_flags = ['no-browser', 'no-mathjax', 'read-only', 'script', 'no-script'] aliases = dict(ipkernel_aliases) diff --git a/IPython/frontend/html/notebook/notebookmanager.py b/IPython/frontend/html/notebook/notebookmanager.py index f4f1e3d..02295c4 100644 --- a/IPython/frontend/html/notebook/notebookmanager.py +++ b/IPython/frontend/html/notebook/notebookmanager.py @@ -23,20 +23,11 @@ import glob from tornado import web -from IPython.config.application import boolean_flag from IPython.config.configurable import LoggingConfigurable from IPython.nbformat import current from IPython.utils.traitlets import Unicode, List, Dict, Bool #----------------------------------------------------------------------------- -# Aliases and Flags -#----------------------------------------------------------------------------- - -manager_flags =boolean_flag('script', 'NotebookManager.save_script', - 'Auto-save a .py script everytime the .ipynb notebook is saved', - 'Do not auto-save .py scripts for every notebook') - -#----------------------------------------------------------------------------- # Classes #-----------------------------------------------------------------------------