[IPython-dev] Passing information to a NotebookManager

Konrad Hinsen konrad.hinsen at fastmail.net
Tue Jan 28 06:31:49 EST 2014


Creating a NotebookApp with a modified notebook manager is easy enough:
just configure NotebookApp.notebook_manager_class. But I need additional
information passed to my notebook manager. Since I don't control the
creation of the notebook manager object, I need to find some other way.

I tried to use the configuration system, setting configuration options
at run time:

    from IPython.html.notebookapp import NotebookApp

    app = NotebookApp()
    app.config.NotebookApp.notebook_manager_class = 'activepapers.notebooks.ActivePapersNotebookManager'
    app.config.ActivePapersNotebookManager.active_paper_path = filename
    app.config.ActivePapersNotebookManager.may_write = True
    app.initialize(argv=[])
    app.start()

In my class ActivePapersNotebookManager, I have

    class ActivePapersNotebookManager(NotebookManager):

        active_paper_path = Unicode(config=True)
        active_paper_may_write = Bool(config=True)

followed by the code. This works fine for active_paper_path, but
active_paper_may_write ends up being False.

Questions:

 1) Is this the right approach, or should I try something else entirely?
 2) How can I debug the information transfer through the configuration system?

Thanks in advance,
  Konrad.



More information about the IPython-dev mailing list