##// END OF EJS Templates
Fix up magic_edit functions so they work again.
Thomas Kluyver -
Show More
@@ -2245,7 +2245,7 b' Currently the magic system has the following functions:\\n"""'
2245 2245 filename = self.shell.mktempfile(data)
2246 2246 print 'IPython will make a temporary file named:',filename
2247 2247
2248 return filename
2248 return filename, lineno, use_temp
2249 2249
2250 2250 def _edit_macro(self,mname,macro):
2251 2251 """open an editor with the macro data in a file"""
@@ -2407,7 +2407,7 b' Currently the magic system has the following functions:\\n"""'
2407 2407 opts,args = self.parse_options(parameter_s,'prxn:')
2408 2408
2409 2409 try:
2410 filename = self._find_edit_target(args, opts, last_call)
2410 filename, lineno, is_temp = self._find_edit_target(args, opts, last_call)
2411 2411 except MacroToEdit as e:
2412 2412 self._edit_macro(args, e.args[0])
2413 2413 return
@@ -2433,15 +2433,14 b' Currently the magic system has the following functions:\\n"""'
2433 2433 print
2434 2434 else:
2435 2435 print 'done. Executing edited code...'
2436 if opts_raw:
2436 if 'r' in opts: # Untranslated IPython code
2437 2437 self.shell.run_cell(file_read(filename),
2438 2438 store_history=False)
2439 2439 else:
2440 2440 self.shell.safe_execfile(filename,self.shell.user_ns,
2441 2441 self.shell.user_ns)
2442
2443 2442
2444 if use_temp:
2443 if is_temp:
2445 2444 try:
2446 2445 return open(filename).read()
2447 2446 except IOError,msg:
@@ -29,6 +29,7 b' from IPython.core.autocall import ZMQExitAutocall'
29 29 from IPython.core.displayhook import DisplayHook
30 30 from IPython.core.displaypub import DisplayPublisher
31 31 from IPython.core.macro import Macro
32 from IPython.core.magic import MacroToEdit
32 33 from IPython.core.payloadpage import install_payload_page
33 34 from IPython.utils import io
34 35 from IPython.utils.path import get_py_filename
@@ -398,11 +399,14 b' class ZMQInteractiveShell(InteractiveShell):'
398 399 starting example for further modifications. That file also has
399 400 general instructions on how to set a new hook for use once you've
400 401 defined it."""
402
403 opts,args = self.parse_options(parameter_s,'prn:')
404
401 405 try:
402 filename = self._find_edit_target(args, opts, last_call)
406 filename, lineno, _ = self._find_edit_target(args, opts, last_call)
403 407 except MacroToEdit as e:
404 408 # TODO: Implement macro editing over 2 processes.
405 print "Macro editing not yet implemented in 2-process model."
409 print("Macro editing not yet implemented in 2-process model.")
406 410 return
407 411
408 412 # Make sure we send to the client an absolute path, in case the working
General Comments 0
You need to be logged in to leave comments. Login now