diff --git a/IPython/hooks.py b/IPython/hooks.py index 4ec7ce0..1ce65b3 100644 --- a/IPython/hooks.py +++ b/IPython/hooks.py @@ -32,7 +32,7 @@ ip.set_hook('editor', calljed) You can then enable the functionality by doing 'import myiphooks' somewhere in your configuration files or ipython command line. -$Id: hooks.py 1214 2006-03-16 17:22:15Z vivainio $""" +$Id: hooks.py 1274 2006-04-26 14:01:37Z vivainio $""" #***************************************************************************** # Copyright (C) 2005 Fernando Perez. @@ -130,8 +130,10 @@ class CommandChainDispatcher: try: ret = cmd(*args, **kw) return ret - except ipapi.TryNext: - pass + except ipapi.TryNext, exc: + if exc.args or exc.kwargs: + args = exc.args + kw = exc.kwargs def __str__(self): return str(self.chain) diff --git a/IPython/ipapi.py b/IPython/ipapi.py index fa28a9d..0acea7e 100644 --- a/IPython/ipapi.py +++ b/IPython/ipapi.py @@ -66,9 +66,15 @@ class TryNext(Exception): Raise this in your hook function to indicate that the next hook handler should be used to handle the operation. + If you pass arguments to the constructor those arguments will be + used by the next hook instead of the original ones. """ - - + + def __init__(self, *args, **kwargs): + self.args = args + self.kwargs = kwargs + + # contains the most recently instantiated IPApi _recent = None