##// END OF EJS Templates
Ensure that an absolute path is encoded in %edit payload.
Fernando Perez -
Show More
@@ -1,8 +1,27 b''
1 """A ZMQ-based subclass of InteractiveShell.
2
3 This code is meant to ease the refactoring of the base InteractiveShell into
4 something with a cleaner architecture for 2-process use, without actually
5 breaking InteractiveShell itself. So we're doing something a bit ugly, where
6 we subclass and override what we want to fix. Once this is working well, we
7 can go back to the base class and refactor the code for a cleaner inheritance
8 implementation that doesn't rely on so much monkeypatching.
9
10 But this lets us maintain a fully working IPython as we develop the new
11 machinery. This should thus be thought of as scaffolding.
12 """
13 #-----------------------------------------------------------------------------
14 # Imports
15 #-----------------------------------------------------------------------------
16 # Stdlib
1 import inspect
17 import inspect
18 import os
2 import re
19 import re
3 import sys
20 import sys
21
4 from subprocess import Popen, PIPE
22 from subprocess import Popen, PIPE
5
23
24 # Our own
6 from IPython.core.interactiveshell import (
25 from IPython.core.interactiveshell import (
7 InteractiveShell, InteractiveShellABC
26 InteractiveShell, InteractiveShellABC
8 )
27 )
@@ -16,9 +35,16 b' from IPython.zmq.session import extract_header'
16 from IPython.core.payloadpage import install_payload_page
35 from IPython.core.payloadpage import install_payload_page
17 from session import Session
36 from session import Session
18
37
38 #-----------------------------------------------------------------------------
39 # Globals and side-effects
40 #-----------------------------------------------------------------------------
41
19 # Install the payload version of page.
42 # Install the payload version of page.
20 install_payload_page()
43 install_payload_page()
21
44
45 #-----------------------------------------------------------------------------
46 # Functions and classes
47 #-----------------------------------------------------------------------------
22
48
23 class ZMQDisplayHook(DisplayHook):
49 class ZMQDisplayHook(DisplayHook):
24
50
@@ -351,6 +377,10 b' class ZMQInteractiveShell(InteractiveShell):'
351 filename = self.shell.mktempfile(data)
377 filename = self.shell.mktempfile(data)
352 print 'IPython will make a temporary file named:',filename
378 print 'IPython will make a temporary file named:',filename
353
379
380 # Make sure we send to the client an absolute path, in case the working
381 # directory of client and kernel don't match
382 filename = os.path.abspath(filename)
383
354 payload = {
384 payload = {
355 'source' : 'IPython.zmq.zmqshell.ZMQInteractiveShell.edit_magic',
385 'source' : 'IPython.zmq.zmqshell.ZMQInteractiveShell.edit_magic',
356 'filename' : filename,
386 'filename' : filename,
General Comments 0
You need to be logged in to leave comments. Login now