ipython/ipython — pull request #1441 by cschin (2012-02-27 05:49:34+00:00)
Title: (1) Enable IPython.notebook.kernel.execute to publish display_* even it is not called with a code cell and (2) remove empty html element when execute "display_*"

(1) If "IPython.notebook.kernel.execute" is called without a cell attached, the "display_javascript" or "display_html" is currently ignored by Notebook.prototype.handle_shell_reply() since there is no cell associated with the python code execution request. The patch allows the message type "display_data" to be accepted by Notebook.prototype.handle_shell_reply() even there is no "cell" attached with the initial IPython.notebook.kernel.execute() request. (For a better design, we might consider to assign such call with special cell id, or make a new type of message.)

(2) Removing html insertion for "display_*" calls. If we put "display_javascript" in a loop, the current noteboot will insert empty html elements and the output cell might become longer (and empty) than necessary. It looks cleaner not generating those empty element.

The patches can allow to execute python through html element, e.g., a button created with javascript in an ipython html notebook. (one example: https://github.com/cschin/IPython-Notebook---d3.js-mashup/blob/master/GDP_CO2_Example.ipynb )