Permalink
Browse files

Merge enhancement from werkzeug console.py

This patch adds a feature whereby the last object returned by the
console is stored in '_' for easier recall.
  • Loading branch information...
1 parent 597c15a commit 876b77a1af81cc8b2b1ec2970956ed40730ae637 @nigelsmith nigelsmith committed Jun 15, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 pyramid_debugtoolbar/console.py
@@ -88,6 +88,7 @@ def displayhook(obj):
# stream._write bypasses escaping as debug_repr is
# already generating HTML for us.
if obj is not None:
+ _local._current_ipy.locals['_'] = obj
stream._write(debug_repr(obj))
displayhook = staticmethod(displayhook)
@@ -203,6 +204,7 @@ def __init__(self, globals=None, locals=None):
self._ipy = _InteractiveConsole(globals, locals)
def eval(self, code):
+ _local._current_ipy = self._ipy
old_sys_stdout = sys.stdout
try:
return self._ipy.runsource(code)

0 comments on commit 876b77a

Please sign in to comment.