##// END OF EJS Templates
fixed cpaste session error
Wenhan Zhu (Cosmos) -
Show More
@@ -41,7 +41,7 b' class TerminalMagics(Magics):'
41 def __init__(self, shell):
41 def __init__(self, shell):
42 super(TerminalMagics, self).__init__(shell)
42 super(TerminalMagics, self).__init__(shell)
43
43
44 def store_or_execute(self, block, name):
44 def store_or_execute(self, block, name, store_history=False):
45 """ Execute a block, or store it in a variable, per the user's request.
45 """ Execute a block, or store it in a variable, per the user's request.
46 """
46 """
47 if name:
47 if name:
@@ -53,7 +53,7 b' class TerminalMagics(Magics):'
53 self.shell.user_ns['pasted_block'] = b
53 self.shell.user_ns['pasted_block'] = b
54 self.shell.using_paste_magics = True
54 self.shell.using_paste_magics = True
55 try:
55 try:
56 self.shell.run_cell(b, store_history=True)
56 self.shell.run_cell(b, store_history)
57 finally:
57 finally:
58 self.shell.using_paste_magics = False
58 self.shell.using_paste_magics = False
59
59
@@ -147,7 +147,7 b' class TerminalMagics(Magics):'
147
147
148 sentinel = opts.get('s', u'--')
148 sentinel = opts.get('s', u'--')
149 block = '\n'.join(get_pasted_lines(sentinel, quiet=quiet))
149 block = '\n'.join(get_pasted_lines(sentinel, quiet=quiet))
150 self.store_or_execute(block, name)
150 self.store_or_execute(block, name, store_history=False)
151
151
152 @line_magic
152 @line_magic
153 def paste(self, parameter_s=''):
153 def paste(self, parameter_s=''):
@@ -203,7 +203,7 b' class TerminalMagics(Magics):'
203 sys.stdout.write("\n")
203 sys.stdout.write("\n")
204 sys.stdout.write("## -- End pasted text --\n")
204 sys.stdout.write("## -- End pasted text --\n")
205
205
206 self.store_or_execute(block, name)
206 self.store_or_execute(block, name, store_history=True)
207
207
208 # Class-level: add a '%cls' magic only on Windows
208 # Class-level: add a '%cls' magic only on Windows
209 if sys.platform == 'win32':
209 if sys.platform == 'win32':
General Comments 0
You need to be logged in to leave comments. Login now