[sagenb] 11/157: always create default users

felix salfelder felix-guest at moszumanska.debian.org
Mon Dec 22 16:51:44 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 537f0c1d58ddb359b0b6b70d1c0b4ea1475bf423
Author: Punarbasu Purkayastha <ppurka at gmail.com>
Date:   Mon Dec 23 17:52:08 2013 +0800

    always create default users
    
    For old notebooks, there was no default user
    and so certain functionality such as documentation
    would not work with recent sage.
    This patch makes sure that the default users are
    always created if they are not present.
---
 sagenb/notebook/run_notebook.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sagenb/notebook/run_notebook.py b/sagenb/notebook/run_notebook.py
index bdafb85..4acc87f 100644
--- a/sagenb/notebook/run_notebook.py
+++ b/sagenb/notebook/run_notebook.py
@@ -575,6 +575,15 @@ def notebook_run(self,
                 print "Login to the Sage notebook as admin with the password you specified above."
         #nb.del_user('root')
 
+    # For old notebooks, make sure that default users are always created.
+    # This fixes issue #175 (https://github.com/sagemath/sagenb/issues/175)
+    um = nb.user_manager()
+    for user in ('_sage_', 'pub'):
+        if not um.user_exists(user):
+            um.add_user(user, '', '', account_type='user', force=True)
+    if not um.user_exists('guest'):
+        um.add_user('guest', '', '', account_type='guest', force=True)
+
     nb.set_server_pool(server_pool)
     nb.set_ulimit(ulimit)
 

-- 
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