diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 232fc38..2cd0d6b 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -331,6 +331,7 @@ class Kernel(Configurable): content = parent[u'content'] code = content[u'code'] silent = content[u'silent'] + store_history = content.get(u'store_history', not silent) except: self.log.error("Got bad msg: ") self.log.error("%s", parent) @@ -366,7 +367,7 @@ class Kernel(Configurable): reply_content = {} try: # FIXME: the shell calls the exception handler itself. - shell.run_cell(code, store_history=not silent, silent=silent) + shell.run_cell(code, store_history=store_history, silent=silent) except: status = u'error' # FIXME: this code right now isn't being used yet by default, diff --git a/docs/source/development/messaging.txt b/docs/source/development/messaging.txt index d723b89..97d73f9 100644 --- a/docs/source/development/messaging.txt +++ b/docs/source/development/messaging.txt @@ -161,11 +161,14 @@ Message type: ``execute_request``:: # sys.displayhook will not fire), and will *not*: # - broadcast exceptions on the PUB socket # - do any logging - # - populate any history # # The default is False. 'silent' : bool, + # A boolean flag which, if True, signals the kernel to populate history + # The default is False if silent is True, or True if silent is False. + 'store_history' : bool, + # A list of variable names from the user's namespace to be retrieved. What # returns is a JSON string of the variable's repr(), not a python object. 'user_variables' : list, @@ -308,7 +311,7 @@ Execution counter (old prompt number) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The kernel has a single, monotonically increasing counter of all execution -requests that are made with ``silent=False``. This counter is used to populate +requests that are made with ``store_history=True``. This counter is used to populate the ``In[n]``, ``Out[n]`` and ``_n`` variables, so clients will likely want to display it in some form to the user, which will typically (but not necessarily) be done in the prompts. The value of this counter will be returned as the @@ -325,9 +328,9 @@ Message type: ``execute_reply``:: # One of: 'ok' OR 'error' OR 'abort' 'status' : str, - # The global kernel counter that increases by one with each non-silent - # executed request. This will typically be used by clients to display - # prompt numbers to the user. If the request was a silent one, this will + # The global kernel counter that increases by one with each request that + # stores history. This will typically be used by clients to display + # prompt numbers to the user. If the request did not store history, this will # be the current value of the counter in the kernel. 'execution_count' : int, }