# HG changeset patch
# User William Stein <wstein@gmail.com>
# Date 1262281848 28800
# Node ID f19a0ed4113db84008f43930ffac2204cb8d361a
# Parent 809ab7de9057eb6ff19b88f8ec890428638ba9a6
trac 7514 -- rewrite load and attach (rebase against sagenb-0.4.8 + #7482)
diff --git a/sagenb/misc/sageinspect.py b/sagenb/misc/sageinspect.py
a
|
b
|
|
54 | 54 | |
55 | 55 | Python classes:: |
56 | 56 | |
| 57 | sage: import sage.misc.attach |
57 | 58 | sage: sage_getfile(sage.misc.attach.Attach) |
58 | 59 | '.../attach.py' |
59 | 60 | |
60 | 61 | sage: sage_getdoc(sage.misc.attach.Attach).lstrip() |
61 | | "Attach a file to a running instance of Sage..." |
| 62 | 'Attach a file to a running instance of Sage...' |
62 | 63 | |
63 | 64 | sage: sage_getsource(sage.misc.attach.Attach) |
64 | 65 | 'class Attach:...' |
diff --git a/sagenb/misc/support.py b/sagenb/misc/support.py
a
|
b
|
|
539 | 539 | return False |
540 | 540 | |
541 | 541 | from sagenb.interfaces.format import displayhook_hack |
542 | | def preparse_worksheet_cell(s): |
| 542 | def preparse_worksheet_cell(s, globals): |
543 | 543 | """ |
544 | 544 | Preparse the contents of a worksheet cell in the notebook, |
545 | 545 | respecting the user using ``preparser(False)`` to turn off the |
… |
… |
|
556 | 556 | - string |
557 | 557 | """ |
558 | 558 | if do_preparse(): |
559 | | s = preparse_file(s, magic=True, do_time=True, ignore_prompts=False, reload_attached=True) |
| 559 | s = preparse_file(s, globals=globals) |
560 | 560 | return displayhook_hack(s) |
diff --git a/sagenb/notebook/worksheet.py b/sagenb/notebook/worksheet.py
a
|
b
|
|
39 | 39 | WorksheetProcess_RemoteExpectImplementation) |
40 | 40 | |
41 | 41 | |
42 | | from sagenb.misc.support import preparse_file |
43 | 42 | import sagenb.misc.support as support |
44 | 43 | |
45 | 44 | # Imports specifically relevant to the sage notebook |
… |
… |
|
3623 | 3622 | return support.get_rightmost_identifier(s) |
3624 | 3623 | |
3625 | 3624 | def preparse(self, s): |
3626 | | return 'exec _support_.preparse_worksheet_cell(base64.b64decode("%s"))'%base64.b64encode(s) |
3627 | | #return 'exec _support_.displayhook_hack(_support_.preparse_file(base64.b64decode("%s"),magic=True,do_time=True,ignore_prompts=False,reload_attached=True))'%base64.b64encode(s) |
| 3625 | return 'exec _support_.preparse_worksheet_cell(base64.b64decode("%s"),globals())'%base64.b64encode(s) |
3628 | 3626 | |
3629 | 3627 | ########################################################## |
3630 | 3628 | # Loading and attaching files |