1. Robert Kern
  2. kernmagic

Commits

Robert Kern  committed 50acfe7

BUG: Allow IPython 0.13

  • Participants
  • Parent commits dc726a7
  • Branches default

Comments (0)

Files changed (1)

File kernmagic/__init__.py

View file
 """
 
 
+def _define_magic(ip, *args, **kwds):
+    """ Compatibility wrapper for defining magics.
+    """
+    shell = getattr(ip, 'shell', ip)
+    shell.define_magic(*args, **kwds)
+
 def activate(ip, *args):
     """ Activate the given magics, all of them by default.
     """
         if not name.startswith('magic_'):
             continue
         magic_name = name[len('magic_'):]
-        ip.shell.define_magic(magic_name, getattr(mymagics, name))
+        _define_magic(ip, magic_name, getattr(mymagics, name))
 
 def activate_aliases(ip, *args):
     """ Activate the requests aliases, all of them by default.
         args = mymagics.aliases.keys()
     for name in args:
         magic_name = mymagics.aliases[name]
-        ip.shell.define_magic(magic_name, getattr(mymagics, name))
+        _define_magic(ip, magic_name, getattr(mymagics, name))
 
 def load_ipython_extension(ip):
     activate(ip)