[sagenb] 26/157: Update cell.py

felix salfelder felix-guest at moszumanska.debian.org
Mon Dec 22 16:51:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit 8783ea63883403f0b12a6f95d9c380c0d673763c
Author: Another GitHub User <aghu at users.noreply.github.com>
Date:   Fri May 30 10:44:25 2014 -0300

    Update cell.py
    
    Changed the URL that Cell.files_html() preppends inside jmol_script for the live help, from cell URL, to worksheet URL. See comments.
---
 sagenb/notebook/cell.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/sagenb/notebook/cell.py b/sagenb/notebook/cell.py
index 8bf1809..a16da18 100644
--- a/sagenb/notebook/cell.py
+++ b/sagenb/notebook/cell.py
@@ -2368,8 +2368,20 @@ class Cell(Cell_generic):
                     jmol_file = open(jmol_name, 'r')
                     jmol_script = jmol_file.read()
                     jmol_file.close()
-
-                    jmol_script = jmol_script.replace('defaultdirectory "', 'defaultdirectory "' + self.url_to_self() + '/')
+                    
+                    # The ".jmol" script has defaultdirectory pointing
+                    # to a zip file [see Graphics3d.show()].  But it is 
+                    # relative to the worksheet URL as seen in the browser.
+                    # But that doesn't make sense for live help.
+                    #
+                    # So we need to preppend the worksheet URL, in order
+                    # to the zip be accessed correctly.
+                    #
+                    # There is no Worsheet.url_to_self(), so calculate it
+                    # in similar manner to Cell.url_to_self()
+                    url_to_ws = '/home/%s/' % self.worksheet_filename()
+                    jmol_script = jmol_script.replace('defaultdirectory "', 
+                                                      'defaultdirectory "' + url_to_ws )
 
                     jmol_file = open(jmol_name, 'w')
                     jmol_file.write(jmol_script)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list