Ask Your Question
1

Changing the name of a notebook user

asked 2011-04-09 14:33:57 +0100

Mike Witt gravatar image

updated 2011-04-09 14:34:54 +0100

I'd like to change the name of a user on my server. An alternative would be to delete the user and add them again with the new name. I can't figure out how to do this. The "User Management" interface in the notebook itself has an "Add User" but not a "Del User." In the reference manual I can see that there is a del_user() function for a notebook. But, the part I'm stuck on is:

nb = load_notebook(dir)

I can't figure out what "dir" is. In other words, I don't know how to find out what that directory is. This is a server that I normally start up by doing the notebook() call (that is, I haven't done anything to put it in any particular directory).

This is: Sage Version 4.6

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-04-09 20:11:25 +0100

Kelvin Li gravatar image

I don't know about re-naming users, but here are all the steps you need to delete a user (adding one is easy enough):

1) Find your notebook directory. The default is $HOME/.sage/sage_notebook.sagenb (on Linux at least). If unsure, start your notebook server. On my machine, there is a line printed that says:

The notebook files are stored in: sage_notebook.sagenb

2) On my machine, this is what I did to delete a user:

sage: nb = sagenb.notebook.notebook.load_notebook("/home/goofy/.sage/sage_notebook.sagenb")
sage: nb.users()
{'admin': admin, 'user2': user2, 'user1': user1}
sage: nb.del_user("user2")
sage: nb.users()
{'admin': admin, 'user1': user1}
sage: nb.save()

3) Remarks

a) In the above example, nothing is done to the actual notebook files until the final step.

b) The function sagenb.notebook.notebook.load_notebook(dir) requires dir NOT to have a trailing "/" to work properly. So, if you use tab-completion (very handy!), be sure to remove that trailing slash. Otherwise, load_notebook would create a new notebook directory (.sagenb) within dir instead of simply opening dir itself as a notebook.

edit flag offensive delete link more

Comments

Thank you. It was the $HOME/.sage/sage_notebook.sagenb that I couldn't figure out.

Mike Witt gravatar imageMike Witt ( 2011-04-09 20:38:02 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-04-09 14:33:57 +0100

Seen: 1,016 times

Last updated: Apr 09 '11