##// END OF EJS Templates
macros are pickleable again. _margv has possible args to macro
vivainio -
Show More
@@ -18,6 +18,8 b' class Macro(IPyAutocall):'
18
18
19 Macro is just a callable that executes a string of IPython
19 Macro is just a callable that executes a string of IPython
20 input when called.
20 input when called.
21
22 Args to macro are available in _margv list if you need them.
21 """
23 """
22
24
23 def __init__(self,data):
25 def __init__(self,data):
@@ -32,7 +34,11 b' class Macro(IPyAutocall):'
32 def __repr__(self):
34 def __repr__(self):
33 return 'IPython.macro.Macro(%s)' % repr(self.value)
35 return 'IPython.macro.Macro(%s)' % repr(self.value)
34
36
35 def __call__(self):
37 def __call__(self,*args):
36 Term.cout.flush()
38 Term.cout.flush()
37
39 self._ip.user_ns['_margv'] = args
38 self._ip.runlines(self.value) No newline at end of file
40 self._ip.runlines(self.value)
41
42 def getstate(self):
43 """ needed for safe pickling via %store """
44 return {'value': self.value} No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now