Package sage :: Package server :: Package notebook :: Module worksheet :: Class Worksheet
[hide private]
[frames] | no frames]

Class Worksheet

source code

Instance Methods [hide private]
 
__init__(self, name, dirname, notebook_worksheet_directory, system, owner, docbrowser=False, pretty_print=False, auto_publish=False)
Create and initialize a new worksheet.
source code
 
__cmp__(self, other)
We compare two worksheets.
source code
 
__repr__(self)
Return string representation of this worksheet, which is simply the string representation of the underlying list of cells.
source code
 
__len__(self)
Return the number of cells in this worksheet.
source code
 
docbrowser(self)
Return True if this is a docbrowser worksheet.
source code
 
conf(self)
Return the configuration object for this worksheet, which is stored in an sobj in the worksheet directory.
source code
 
collaborators(self)
Return a (reference to the) list of the collaborators who can also view and modify this worksheet.
source code
 
set_collaborators(self, v)
Set the list of collaborators to those listed in the list v of strings.
source code
 
viewers(self)
Return list of viewers of this worksheet.
source code
 
delete_notebook_specific_data(self)
Delete data from this worksheet this is specific to a certain notebook.
source code
 
name(self)
Return the name of this worksheet.
source code
 
set_name(self, name)
Set the name of this worksheet.
source code
 
set_filename_without_owner(self, nm)
Set this worksheet filename (actually directory) by getting the owner from the pre-stored owner via \code{self.owner()}.
source code
 
set_filename(self, filename)
Set the worksheet filename (actually directory).
source code
 
filename(self)
Return the filename (really directory) where the files associated to this worksheet are stored.
source code
 
filename_without_owner(self)
Return the part of the worksheet filename after the last /, i.e., without any information about the owner of this worksheet.
source code
 
directory(self)
Return the full path to the directory where this worksheet is stored.
source code
 
data_directory(self)
Return path to directory where worksheet data is stored.
source code
 
attached_data_files(self)
Return a list of the filenames of files in the worksheet data directory.
source code
 
cells_directory(self)
Return the directory in which the cells of this worksheet are evaluated.
source code
 
notebook(self)
Return the notebook that contains this worksheet.
source code
 
DIR(self)
Return the absolute path to the directory that contains the Sage Notebook directory for the notebook that contains this worksheet.
source code
 
system(self)
Return the math software system in which by default all input to the notebook is evaluated.
source code
 
set_system(self, system='sage')
Set the math software system in which input is evaluated by default.
source code
 
pretty_print(self)
Return True if output shold be pretty printed by default.
source code
 
set_pretty_print(self, check='false')
Set whether or not output should be pretty printed by default.
source code
 
is_auto_publish(self)
Returns boolean of "Is this worksheet set to be published automatically when saved?" if private variable "autopublish" is set otherwise False is returned and the variable is set to False.
source code
 
set_auto_publish(self)
Sets the worksheet to be published automatically when the worksheet is saved if the worksheet isn't already set to this otherwise it is set not to.
source code
 
is_published(self)
Return True if this worksheet is a published worksheet.
source code
 
worksheet_that_was_published(self)
Return the worksheet that was published to get this worksheet, if this worksheet was published.
source code
 
publisher(self)
Return username of user that published this worksheet.
source code
 
is_publisher(self, username)
Return True if username is the username of the publisher of this worksheet, assuming this worksheet was published.
source code
 
has_published_version(self)
Return True if there is a published version of this worksheet.
source code
 
set_published_version(self, filename)
Set the published version of this worksheet to be the worksheet with given filename.
source code
 
published_version(self)
If this worksheet was published, return the published version of this worksheet.
source code
 
set_worksheet_that_was_published(self, W)
Set the worksheet that was published to get self to W.
source code
 
rate(self, x, comment, username)
Set the rating on this worksheet by the given user to x and also set the given comment.
source code
 
is_rater(self, username)
Return True is the user with given username has rated this worksheet.
source code
 
ratings(self)
Return all the ratings of this worksheet.
source code
 
html_ratings_info(self)
Return html that renders to give a summary of how this worksheet has been rated.
source code
 
rating(self)
Return overall aerage rating of self.
source code
 
everyone_has_deleted_this_worksheet(self)
Return True if all users have deleted this worksheet, so we know we can safely purge it from disk.
source code
 
user_view(self, user)
Return the view that the given user has of this worksheet.
source code
 
set_user_view(self, user, x)
Set the view on this worksheet for the given user.
source code
 
user_view_is(self, user, x)
Return True if the user view of user is x.
source code
 
is_archived(self, user)
Return True if this worksheet is archived for the given user.
source code
 
is_active(self, user)
Return True if this worksheet is active for the given user.
source code
 
is_trashed(self, user)
Return True if this worksheet is in the trash for the given user.
source code
 
move_to_archive(self, user)
Move this worksheet to be archived for the given user.
source code
 
set_active(self, user)
Set his worksheet to be active for the given user.
source code
 
move_to_trash(self, user)
Move this worksheet to the trash for the given user.
source code
 
move_out_of_trash(self, user)
Exactly the same as set_active(user).
source code
 
delete_cells_directory(self)
Delete the directory in which all the cell computations occur.
source code
 
owner(self) source code
 
is_owner(self, username) source code
 
set_owner(self, owner) source code
 
user_is_only_viewer(self, user) source code
 
user_is_viewer(self, user) source code
 
user_is_collaborator(self, user) source code
 
user_can_edit(self, user)
Return True if the user with given name is allowed to edit this worksheet.
source code
 
delete_user(self, user)
Delete a user from having any view or ownership of this worksheet.
source code
 
add_viewer(self, user)
Add the given user as an allowed viewer of this worksheet.
source code
 
add_collaborator(self, user)
Add the given user as a collaborator on this worksheet.
source code
 
satisfies_search(self, search)
INPUT: search is a string that describes a search query, i.e., a space-separated collections of words.
source code
 
save(self) source code
 
save_snapshot(self, user, E=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...) source code
 
get_snapshot_text_filename(self, name) source code
 
user_autosave_interval(self, username) source code
 
autosave(self, username) source code
 
revert_to_snapshot(self, name) source code
 
_saved_by_info(self, x) source code
 
snapshot_data(self) source code
 
uncache_snapshot_data(self) source code
 
revert_to_last_saved_state(self) source code
 
snapshot_directory(self) source code
 
__getstate__(self)
The getstate method makes sure that the self.__cells dictionary is not saved in the pickle since it could be huge.
source code
 
__setstate__(self, state) source code
 
plain_text(self, prompts=False, banner=True)
Return a plain-text version of the worksheet.
source code
 
input_text(self)
Return text version of the input to the worksheet.
source code
 
edit_text(self)
Returns a plain-text version of the worksheet with \{\{\{\}\}\} wiki-formatting, suitable for hand editing.
source code
 
reset_interact_state(self)
Reset the interact state of this worksheet.
source code
 
edit_save(self, text, ignore_ids=False)
Set the contents of this worksheet to the worksheet defined by the plain text string text, which should be a sequence of html and {{{}}}'s code blocks.
source code
 
html(self, include_title=True, do_print=False, confirm_before_leave=False, read_only=False) source code
 
truncated_name(self, max=30) source code
 
html_title(self, username='guest') source code
 
is_doc_worksheet(self) source code
 
set_is_doc_worksheet(self, value) source code
 
html_save_discard_buttons(self) source code
 
html_share_publish_buttons(self, select=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., backwards=False) source code
 
html_data_options_list(self) source code
 
html_file_menu(self) source code
 
html_menu(self) source code
 
html_worksheet_body(self, do_print, publish=False) source code
 
javascript_for_being_active_worksheet(self) source code
 
javascript_for_jsmath_rendering(self) source code
 
javascript_confirm_before_leave(self) source code
 
last_edited(self) source code
 
date_edited(self)
Returns the date the worksheet was last edited if already recorded otherwise the current local time is recorded and returned.
source code
 
last_to_edit(self) source code
 
record_edit(self, user) source code
 
time_since_last_edited(self) source code
 
warn_about_other_person_editing(self, username, threshold)
Check to see if another user besides username was the last to edit this worksheet during the last \var{threshold} seconds.
source code
 
html_time_since_last_edited(self) source code
 
html_time_last_edited(self) source code
 
cell_id_list(self)
Return a new list of the id's of cells in this worksheet.
source code
 
compute_cell_id_list(self) source code
 
cell_list(self)
Return a reference to the list of the all the cells in this worksheet.
source code
 
append_new_cell(self)
Create and append a new cell to the list of cells.
source code
 
new_cell_before(self, id, input='')
Insert a new cell into the cell list before the cell with the given integer id.
source code
 
new_cell_after(self, id, input='')
Insert a new cell into the cell list after the cell with the given integer id.
source code
 
delete_cell_with_id(self, id)
Remove the cell with given id and return the cell before it.
source code
 
clear(self) source code
 
computing(self)
Return whether or not a cell is currently being run in the worksheet Sage process.
source code
 
set_not_computing(self) source code
 
quit(self) source code
 
next_block_id(self) source code
 
compute_process_has_been_started(self)
Return True precisely if the compute process has been started, irregardless of whether or not it is currently churning away on a computation.
source code
 
initialize_sage(self) source code
 
sage(self)
Return a started up copy of Sage initialized for computations.
source code
 
eval_asap_no_output(self, cmd, username=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...) source code
 
start_next_comp(self) source code
 
check_comp(self, wait=0.2)
Check on currently computing cells in the queue.
source code
 
interrupt(self)
Interrupt all currently queued up calculations.
source code
 
clear_queue(self) source code
 
restart_sage(self)
Restart \sage kernel.
source code
 
worksheet_command(self, cmd) source code
 
quit_if_idle(self, timeout)
Quit the worksheet process if it has been ``idle'' for more than \var{timeout} seconds, where idle is by definition that the worksheet has not reported back that it is actually computing.
source code
 
time_idle(self) source code
 
last_compute_walltime(self) source code
 
_record_that_we_are_computing(self, username=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...) source code
 
ping(self, username) source code
 
queue(self) source code
 
queue_id_list(self) source code
 
_enqueue_auto(self) source code
 
enqueue(self, C, username=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., next=False)
Queue up the cell C for evaluation in this worksheet.
source code
 
_enqueue_auto_cells(self) source code
 
set_cell_counter(self) source code
 
_new_text_cell(self, plain_text, id=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...) source code
 
next_hidden_id(self) source code
 
_new_cell(self, id=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., hidden=False, input='') source code
 
append(self, L) source code
 
__getitem__(self, n) source code
 
get_cell_with_id(self, id) source code
 
synchronize(self, s) source code
 
synchro(self) source code
 
delete_cell_input_files(self)
Delete all the files \file{code_\%s.py} and \file{code_\%s.spyx} that are created when evaluating cells.
source code
 
check_cell(self, id)
Check the status on computation of the cell with given id.
source code
 
is_last_id_and_previous_is_nonempty(self, id) source code
 
best_completion(self, s, word) source code
 
completions_html(self, id, s, cols=3) source code
 
preparse_input(self, input, C) source code
 
preparse_introspection_input(self, input, C, introspect) source code
 
preparse_nonswitched_input(self, input) source code
 
_strip_synchro_from_start_of_output(self, s) source code
 
_process_output(self, s) source code
 
postprocess_output(self, out, C) source code
 
_get_last_identifier(self, s) source code
 
preparse(self, s) source code
 
load_any_changed_attached_files(self, s)
Modify \var{s} by prepending any necessary load commands corresponding to attached files that have changed.
source code
 
attached_files(self) source code
 
attach(self, filename) source code
 
detach(self, filename) source code
 
_normalized_filenames(self, L) source code
 
load_path(self) source code
 
hunt_file(self, filename) source code
 
_load_file(self, filename, files_seen_so_far, this_file) source code
 
_save_objects(self, s) source code
 
do_sage_extensions_preparsing(self, s, files_seen_so_far=[], this_file='') source code
 
_eval_cmd(self, system, cmd, dir) source code
 
cython_import(self, cmd, C) source code
 
check_for_system_switching(self, s, C)
Check for input cells that start with \code{\%foo}, where \var{foo} is an object with an eval method.
source code
 
attached_html(self) source code
 
show_all(self) source code
 
hide_all(self) source code
 
delete_all_output(self, username)
Delete all the output in all the worksheet cells.
source code
Method Details [hide private]

__init__(self, name, dirname, notebook_worksheet_directory, system, owner, docbrowser=False, pretty_print=False, auto_publish=False)
(Constructor)

source code 

Create and initialize a new worksheet.

INPUT:
    name    -- string; the name of this worksheet
    dirname -- string; name of the directory in which the worksheet's
               data is stored
    notebook_worksheet_directory -- string; the directory in which the
               notebook object that contains this worksheet
               stores worksheets, i.e., nb.worksheet_directory().
    system -- string; 'sage', 'gp', 'singular', etc. -- the math software
              system in which all code is evaluated by default
    owner  -- string; username of the owner of this worksheet
    docbrowser -- bool (default: False); whether this is a docbrowser worksheet
    pretty_print -- bool (default: False); whether all output is pretty printed
                    by default.

EXAMPLES:
We test the constructor via an indirect doctest:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Test', 'admin')
    sage: W
    [Cell 0; in=, out=]

__cmp__(self, other)
(Comparison operator)

source code 

We compare two worksheets.

INPUT:
    self, other -- worksheets
OUTPUT:
    -1,0,1 -- comparison is on the underlying filenames.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W2 = nb.create_new_worksheet('test2', 'admin')
    sage: W1 = nb.create_new_worksheet('test1', 'admin')
    sage: cmp(W1, W2)
    1
    sage: cmp(W2, W1)
    -1

__repr__(self)
(Representation operator)

source code 

        Return string representation of this worksheet, which is
        simply the string representation of the underlying list of
        cells.

        OUTPUT:
            string

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('test1', 'admin')
            sage: W.__repr__()
            '[Cell 0; in=, out=]'
            sage: W.edit_save('Sage
{{{
2+3
///
5
}}}
{{{id=10|
2+8
///
10
}}}')
            sage: W.__repr__()
            '[Cell 0; in=2+3, out=5, Cell 10; in=2+8, out=10]'
        

__len__(self)
(Length operator)

source code 

        Return the number of cells in this worksheet.

        OUTPUT:
            int

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('test1', 'admin')
            sage: len(W)
            1
            sage: W.edit_save('Sage
{{{
2+3
///
5
}}}
{{{id=10|
2+8
///
10
}}}')
            sage: len(W)
            2
        

docbrowser(self)

source code 

Return True if this is a docbrowser worksheet.

OUTPUT:
    bool

EXAMPLES:
We first create a standard worksheet for which docbrowser is of course False:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('test1', 'admin')
    sage: W.docbrowser()
    False

We create a worksheet for which docbrowser is True:
    sage: W = nb.create_new_worksheet('docs', 'admin', docbrowser=True)
    sage: W.docbrowser()
    True

conf(self)

source code 

Return the configuration object for this worksheet, which is
stored in an sobj in the worksheet directory.

OUTPUT:
    worksheet configuration object.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('test1', 'admin')
    sage: W.conf()
    Configuration: {}

collaborators(self)

source code 

Return a (reference to the) list of the collaborators who can
also view and modify this worksheet.

OUTPUT:
    list

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('test1', 'admin')
    sage: C = W.collaborators(); C
    []
    sage: C.append('sage')
    sage: W.collaborators()
    ['sage']

set_collaborators(self, v)

source code 

Set the list of collaborators to those listed in the
list v of strings.

INPUT:
    v -- a list of strings

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
    sage: nb.add_user('hilbert','sage','sage@sagemath.org',force=True)
    sage: W = nb.create_new_worksheet('test1', 'admin')
    sage: W.set_collaborators(['sage', 'admin', 'hilbert', 'sage'])

Note that repeats are not added multiple times and admin --
the owner -- isn't added:
    sage: W.collaborators()
    ['hilbert', 'sage']

viewers(self)

source code 

Return list of viewers of this worksheet.

OUTPUT:
   list -- of string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
    sage: nb.add_user('hilbert','sage','sage@sagemath.org',force=True)
    sage: W = nb.create_new_worksheet('test1', 'admin')
    sage: W.add_viewer('hilbert')
    sage: W.viewers()
    ['hilbert']
    sage: W.add_viewer('sage')
    sage: W.viewers()
    ['hilbert', 'sage']

delete_notebook_specific_data(self)

source code 

Delete data from this worksheet this is specific to a certain
notebook.  This means deleting the attached files,
collaborators, and viewers.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('hilbert','sage','sage@sagemath.org',force=True)
    sage: W = nb.create_new_worksheet('test1', 'admin')
    sage: W.add_viewer('hilbert')
    sage: W.delete_notebook_specific_data()
    sage: W.viewers()
    []
    sage: W.add_collaborator('hilbert')
    sage: W.collaborators()
    ['admin', 'hilbert']
    sage: W.delete_notebook_specific_data()
    sage: W.collaborators()
    ['admin']

name(self)

source code 

Return the name of this worksheet.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.name()
    'A Test Worksheet'

set_name(self, name)

source code 

Set the name of this worksheet.

INPUT:
    name -- string

EXAMPLES:
We create a worksheet and change the name:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.set_name('A renamed worksheet')
    sage: W.name()
    'A renamed worksheet'

set_filename_without_owner(self, nm)

source code 

Set this worksheet filename (actually directory) by getting
the owner from the pre-stored owner via \code{self.owner()}.

INPUT:
    nm -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.filename()
    'admin/0'
    sage: W.set_filename_without_owner('5')
    sage: W.filename()
    'admin/5'

set_filename(self, filename)

source code 

Set the worksheet filename  (actually directory).

INPUT:
   filename -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.filename()
    'admin/0'
    sage: W.set_filename('admin/10')
    sage: W.filename()
    'admin/10'

filename(self)

source code 

Return the filename (really directory) where the files associated
to this worksheet are stored.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.filename()
    'admin/0'
    sage: sorted(os.listdir(nb.directory() + '/worksheets/' + W.filename()))
    ['snapshots', 'worksheet.txt']

filename_without_owner(self)

source code 

Return the part of the worksheet filename after the last /,
i.e., without any information about the owner of this
worksheet.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.filename_without_owner()
    '0'
    sage: W.filename()
    'admin/0'

directory(self)

source code 

Return the full path to the directory where this
worksheet is stored.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.directory()
    '.../worksheets/admin/0'

data_directory(self)

source code 

Return path to directory where worksheet data is stored.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.data_directory()
    '.../worksheets/admin/0/data/'

attached_data_files(self)

source code 

Return a list of the filenames of files in the worksheet data directory.

OUTPUT:
    list of strings

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.attached_data_files()
    []
    sage: open('%s/foo.data'%W.data_directory(),'w').close()
    sage: W.attached_data_files()
    ['foo.data']

cells_directory(self)

source code 

Return the directory in which the cells of this worksheet
are evaluated.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.cells_directory()
    '.../worksheets/admin/0/cells/'

notebook(self)

source code 

Return the notebook that contains this worksheet.

OUTPUT:
    a Notebook object.

EXAMPLES:
This really returns the Notebook object that is set as a global
variable of the twist module.

    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.notebook()
    <class 'sage.server.notebook.notebook.Notebook'>
    sage: W.notebook() is sage.server.notebook.twist.notebook
    True

DIR(self)

source code 

Return the absolute path to the directory that contains
the Sage Notebook directory for the notebook that contains
this worksheet.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.DIR()   # random output
    '/Users/was/.sage/temp/teragon_2.local/19129'

system(self)

source code 

Return the math software system in which by default all input
to the notebook is evaluated.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.system()
    'sage'
    sage: W.set_system('mathematica')
    sage: W.system()
    'mathematica'

set_system(self, system='sage')

source code 

Set the math software system in which input is evaluated by
default.

INPUT:
    sysem -- string (default: 'sage')

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.set_system('magma')
    sage: W.system()
    'magma'

pretty_print(self)

source code 

Return True if output shold be pretty printed by default.

OUTPUT:
    bool -- True of False

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.pretty_print()
    False
    sage: W.set_pretty_print('true')
    sage: W.pretty_print()
    True

set_pretty_print(self, check='false')

source code 

Set whether or not output should be pretty printed by default.

INPUT:
    check -- string (default: 'false'); either 'true' or 'false'.

NOTE: The reason the input is a string and lower case instead
of a Python bool is because this gets called indirectory from
javascript.  (And, Jason Grout wrote this and didn't realize
how unpythonic this design is -- it should be redone to use
True/False.)

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
    sage: W.set_pretty_print('false')
    sage: W.pretty_print()
    False
    sage: W.set_pretty_print('true')
    sage: W.pretty_print()
    True

is_published(self)

source code 

Return True if this worksheet is a published worksheet.

OUTPUT:
    bool -- whether or not owner is 'pub'

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.is_published()
    False
    sage: W.set_owner('pub')
    sage: W.is_published()
    True

worksheet_that_was_published(self)

source code 

Return the worksheet that was published to get this worksheet,
if this worksheet was published.  Otherwise just return this
worksheet.

OUTPUT:
    Worksheet

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.worksheet_that_was_published() is W
    True

    sage: S = nb.publish_worksheet(W, 'admin')
    sage: S.worksheet_that_was_published() is S
    False
    sage: S.worksheet_that_was_published() is W
    True

publisher(self)

source code 

Return username of user that published this worksheet.

OUTPUT:
    string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: S = nb.publish_worksheet(W, 'admin')
    sage: S.publisher()
    'admin'

is_publisher(self, username)

source code 

Return True if username is the username of the publisher
of this worksheet, assuming this worksheet was published.

INPUT:
    username -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: P = nb.publish_worksheet(W, 'admin')
    sage: P.is_publisher('hearst')
    False
    sage: P.is_publisher('admin')
    True

has_published_version(self)

source code 

Return True if there is a published version of this worksheet.

OUTPUT:
    bool

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: P = nb.publish_worksheet(W, 'admin')
    sage: P.has_published_version()
    False
    sage: W.has_published_version()
    True

set_published_version(self, filename)

source code 

Set the published version of this worksheet to be the
worksheet with given filename.

INPUT:
    filename -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: P = nb.publish_worksheet(W, 'admin')  # indirect test
    sage: W._Worksheet__published_version
    'pub/0'
    sage: W.set_published_version('pub/0')

published_version(self)

source code 

If this worksheet was published, return the published version
of this worksheet.  Otherwise, raise a ValueError.

OUTPUT:
    a worksheet (or raise a ValueError)

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: P = nb.publish_worksheet(W, 'admin')
    sage: W.published_version() is P
    True

set_worksheet_that_was_published(self, W)

source code 

Set the worksheet that was published to get self to W.

INPUT:
    W -- a Worksheet
   
EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: P = nb.publish_worksheet(W, 'admin')
    sage: P.worksheet_that_was_published() is W
    True

We fake things and make it look like P published itself:
    sage: P.set_worksheet_that_was_published(P)
    sage: P.worksheet_that_was_published() is P
    True

rate(self, x, comment, username)

source code 

Set the rating on this worksheet by the given user to x and
also set the given comment.

INPUT:
    x -- integer
    comment -- string
    usename -- string

EXAMPLES:
We create a worksheet and rate it, then look at the ratings. 
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.rate(3, 'this is great', 'hilbert')
    sage: W.ratings()
    [('hilbert', 3, 'this is great')]

Note that only the last rating by a user counts:
    sage: W.rate(1, 'this lacks content', 'riemann')
    sage: W.rate(0, 'this lacks content', 'riemann')
    sage: W.ratings()
    [('hilbert', 3, 'this is great'), ('riemann', 0, 'this lacks content')]

is_rater(self, username)

source code 

Return True is the user with given username has rated this worksheet.

INPUT:
    username -- string

OUTPUT:
    bool

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.rate(0, 'this lacks content', 'riemann')
    sage: W.is_rater('admin')
    False
    sage: W.is_rater('riemann')
    True

ratings(self)

source code 

Return all the ratings of this worksheet.

OUTPUT:
    list -- a reference to the list of ratings.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.ratings()
    []
    sage: W.rate(0, 'this lacks content', 'riemann')
    sage: W.rate(3, 'this is great', 'hilbert')
    sage: W.ratings()
    [('riemann', 0, 'this lacks content'), ('hilbert', 3, 'this is great')]

html_ratings_info(self)

source code 

        Return html that renders to give a summary of how this
        worksheet has been rated.

        OUTPUT:
           string -- a string of HTML as a bunch of table rows.

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Publish Test', 'admin')
            sage: W.rate(0, 'this lacks content', 'riemann')
            sage: W.rate(3, 'this is great', 'hilbert')
            sage: W.html_ratings_info()
            '<tr><td>hilbert</td><td align=center>3</td><td>this is great</td></tr>
<tr><td>riemann</td><td align=center>0</td><td>this lacks content</td></tr>'
        

rating(self)

source code 

Return overall aerage rating of self.

OUTPUT:
    float or the int -1 to mean "not rated"

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.rating()
    -1
    sage: W.rate(0, 'this lacks content', 'riemann')
    sage: W.rate(3, 'this is great', 'hilbert')
    sage: W.rating()
    1.5

everyone_has_deleted_this_worksheet(self)

source code 

Return True if all users have deleted this worksheet,
so we know we can safely purge it from disk.

OUTPUT:
   bool

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.everyone_has_deleted_this_worksheet()
    False
    sage: W.move_to_trash('admin')
    sage: W.everyone_has_deleted_this_worksheet()
    True

user_view(self, user)

source code 

Return the view that the given user has of this worksheet.  If
the user currently doesn't have a view set it to ACTIVE and
return ACTIVE.

INPUT:
    user -- a string

OUTPUT:
    Python int -- one of ACTIVE, ARCHIVED, TRASH, which are
    defined in worksheet.py

EXAMPLES:
We create a new worksheet and get the view, which is ACTIVE:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.user_view('admin')
    1
    sage: sage.server.notebook.worksheet.ACTIVE
    1

Now for the admin user we move W to the archive:
    sage: W.move_to_archive('admin')

The view is now archive.
    sage: W.user_view('admin')
    0
    sage: sage.server.notebook.worksheet.ARCHIVED
    0

For any other random viewer the view is set by default
to ACTIVE.
    sage: W.user_view('foo')
    1

set_user_view(self, user, x)

source code 

Set the view on this worksheet for the given user.

INPUT:
    user -- a string
    x -- int, one of the variables ACTIVE, ARCHIVED, TRASH in worksheet.py

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.set_user_view('admin', sage.server.notebook.worksheet.ARCHIVED)
    sage: W.user_view('admin') == sage.server.notebook.worksheet.ARCHIVED
    True

user_view_is(self, user, x)

source code 

Return True if the user view of user is x.

INPUT:
    user -- a string
    x -- int, one of the variables ACTIVE, ARCHIVED, TRASH in worksheet.py

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Publish Test', 'admin')
    sage: W.user_view_is('admin', sage.server.notebook.worksheet.ARCHIVED)
    False
    sage: W.user_view_is('admin', sage.server.notebook.worksheet.ACTIVE)
    True

is_archived(self, user)

source code 

Return True if this worksheet is archived for the given user.

INPUT:
    user -- string
OUTPUT:
    bool

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Archived Test', 'admin')
    sage: W.is_archived('admin')
    False
    sage: W.move_to_archive('admin')
    sage: W.is_archived('admin')
    True

is_active(self, user)

source code 

Return True if this worksheet is active for the given user.

INPUT:
    user -- string
OUTPUT:
    bool

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Active Test', 'admin')
    sage: W.is_active('admin')
    True
    sage: W.move_to_archive('admin')
    sage: W.is_active('admin')
    False

is_trashed(self, user)

source code 

Return True if this worksheet is in the trash for the given user.

INPUT:
    user -- string
OUTPUT:
    bool

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Trash Test', 'admin')
    sage: W.is_trashed('admin')
    False
    sage: W.move_to_trash('admin')
    sage: W.is_trashed('admin')
    True

move_to_archive(self, user)

source code 

Move this worksheet to be archived for the given user.

INPUT:
    user -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Archive Test', 'admin')
    sage: W.move_to_archive('admin')
    sage: W.is_archived('admin')
    True

set_active(self, user)

source code 

Set his worksheet to be active for the given user.

INPUT:
    user -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Active Test', 'admin')
    sage: W.move_to_archive('admin')
    sage: W.is_active('admin')
    False
    sage: W.set_active('admin')
    sage: W.is_active('admin')
    True

move_to_trash(self, user)

source code 

Move this worksheet to the trash for the given user.

INPUT:
    user -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Trash Test', 'admin')
    sage: W.move_to_trash('admin')
    sage: W.is_trashed('admin')
    True

move_out_of_trash(self, user)

source code 

Exactly the same as set_active(user).

INPUT:
   user -- string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Active Test', 'admin')
    sage: W.move_to_trash('admin')
    sage: W.is_active('admin')
    False
    sage: W.move_out_of_trash('admin')
    sage: W.is_active('admin')
    True

delete_cells_directory(self)

source code 

        Delete the directory in which all the cell computations occur.

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
            sage: W = nb.create_new_worksheet('Test', 'sage')
            sage: W.edit_save('Sage
{{{
3^20
}}}')
            sage: sorted(os.listdir(W.directory()))
            ['snapshots', 'worksheet.txt']
            sage: W.cell_list()[0].evaluate()
            sage: sorted(os.listdir(W.directory()))
            ['cells', 'code', 'data', 'snapshots', 'worksheet.txt']
            sage: W.delete_cells_directory()
            sage: sorted(os.listdir(W.directory()))
            ['code', 'data', 'snapshots', 'worksheet.txt']
        

user_can_edit(self, user)

source code 

Return True if the user with given name is allowed to edit this worksheet.

INPUT:
    user -- string
OUTPUT:
    bool

EXAMPLES:
We create a notebook with one worksheet and two users.
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
    sage: nb.add_user('william', 'william', 'wstein@sagemath.org', force=True)
    sage: W = nb.create_new_worksheet('Test', 'sage')
    sage: W.user_can_edit('sage')
    True

At first the user 'william' can't edit this worksheet:
    sage: W.user_can_edit('william')
    False

After adding 'william' as a collaborator he can edit the worksheet.
    sage: W.add_collaborator('william')
    sage: W.user_can_edit('william')
    True

Clean up:
    sage: nb.delete()

delete_user(self, user)

source code 

Delete a user from having any view or ownership of this worksheet.

INPUT:
    user -- string; the name of a user

EXAMPLES:
We create a notebook with 2 users and 1 worksheet that both view.
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('wstein','sage','wstein@sagemath.org',force=True)
    sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
    sage: W = nb.new_worksheet_with_title_from_text('Sage', owner='sage')
    sage: W.add_viewer('wstein')
    sage: W.owner()
    'sage'
    sage: W.viewers()
    ['wstein']

We delete the sage user from the worksheet W.   This makes wstein the
new owner. 
    sage: W.delete_user('sage')
    sage: W.viewers()
    ['wstein']
    sage: W.owner()
    'wstein'

Then we delete wstein from W, which makes the owner None:
    sage: W.delete_user('wstein')
    sage: W.owner() is None
    True
    sage: W.viewers()
    []

Finally, we clean up.
    sage: nb.delete()

add_viewer(self, user)

source code 

Add the given user as an allowed viewer of this worksheet.

INPUT:
    user -- string (username)

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('diophantus','sage','sage@sagemath.org',force=True)
    sage: W = nb.create_new_worksheet('Viewer test', 'admin')
    sage: W.add_viewer('diophantus')
    sage: W.viewers()
    ['diophantus']

add_collaborator(self, user)

source code 

Add the given user as a collaborator on this worksheet.

INPUT:
    user -- a string

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: nb.add_user('diophantus','sage','sage@sagemath.org',force=True)
    sage: W = nb.create_new_worksheet('Collaborator test', 'admin')
    sage: W.collaborators()
    []
    sage: W.add_collaborator('diophantus')
    sage: W.collaborators()
    ['diophantus']

satisfies_search(self, search)

source code 

INPUT:
    search is a string that describes a search query, i.e.,
    a space-separated collections of words.
    
OUTPUT:
    True if the search is satisfied by self, i.e., all
    the words appear in the text version of self. 

__getstate__(self)

source code 

The getstate method makes sure that the self.__cells
dictionary is not saved in the pickle since it could be huge.

OUTPUT:
    a dictionary; same as self.__dict__ but with some fields deleted.

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')
    sage: v = W.__getstate__().keys(); v.sort(); v
    ['_Worksheet__autopublish', '_Worksheet__collaborators', '_Worksheet__comp_is_running', '_Worksheet__dir', '_Worksheet__docbrowser', '_Worksheet__filename', '_Worksheet__name', '_Worksheet__next_id', '_Worksheet__owner', '_Worksheet__pretty_print', '_Worksheet__queue', '_Worksheet__saved_by_info', '_Worksheet__system', '_Worksheet__viewers']

plain_text(self, prompts=False, banner=True)

source code 

Return a plain-text version of the worksheet.

INPUT:
    prompts -- if True format for inclusion in docstrings.

edit_save(self, text, ignore_ids=False)

source code 

        Set the contents of this worksheet to the worksheet defined by
        the plain text string text, which should be a sequence of html
        and {{{}}}'s code blocks.

        INPUT:
            text -- a string
            ignore_ids -- bool (default: False); if True ignore all the
                          id's in the {{{}}} code block.

        EXAMPLES:
        We create a new test notebook and a worksheet.
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
            sage: W = nb.create_new_worksheet('Test Edit Save', 'sage')

        We set the contents of the worksheet using the edit_save command. 
            sage: W.edit_save('Sage
{{{
2+3
///
5
}}}
{{{
2+8
///
10
}}}')
            sage: W
            [Cell 0; in=2+3, out=5, Cell 1; in=2+8, out=10]
            sage: W.name()
            'Sage'
        

warn_about_other_person_editing(self, username, threshold)

source code 

Check to see if another user besides username was the last to
edit this worksheet during the last \var{threshold} seconds.  If
so, return True and that user name.  If not, return False.

INPUT:
   username -- user who would like to edit this file.
   threshold -- number of seconds, so if there was no activity on
           this worksheet for this many seconds, then editing is
           considered safe.

cell_id_list(self)

source code 

        Return a new list of the id's of cells in this worksheet.

        OUTPUT:
            a new list

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')

        Now we set the worksheet to have two cells with the default id
        of 0 and another with id 10.
            sage: W.edit_save('Sage
{{{
2+3
///
5
}}}
{{{id=10|
2+8
///
10
}}}')
            sage: W.cell_id_list()
            [0, 10]
        

cell_list(self)

source code 

        Return a reference to the list of the all the cells in this worksheet.

        OUTPUT:
            list -- a list of cells

        NOTE: This function loads the cell list from disk (the file
        worksheet.txt) if it isn't available in memory.

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')
            sage: W.edit_save('Sage
{{{
2+3
///
5
}}}
{{{
2+8
///
10
}}}')
            sage: v = W.cell_list(); v
            [Cell 0; in=2+3, out=5, Cell 1; in=2+8, out=10]
            sage: v[0]
            Cell 0; in=2+3, out=5
        

append_new_cell(self)

source code 

Create and append a new cell to the list of cells.

OUTPUT:
    a new empty cell

EXAMPLES:
    sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
    sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')
    sage: W
    [Cell 0; in=, out=]
    sage: W.append_new_cell()
    Cell 1; in=, out=
    sage: W
    [Cell 0; in=, out=, Cell 1; in=, out=]

new_cell_before(self, id, input='')

source code 

Insert a new cell into the cell list before the cell
with the given integer id.  If the id is not the
id of any cell, inserts a new cell at the end of the
cell list.

INPUT:
    id -- integer
    input -- string

OUTPUT:
    new cell with the given input text (empty by default).
 

new_cell_after(self, id, input='')

source code 

Insert a new cell into the cell list after the cell
with the given integer id.

INPUT:
    id -- integer
    input -- string

OUTPUT:
    new cell with the given input text (empty by default).

sage(self)

source code 

Return a started up copy of Sage initialized for computations.

If this is a published worksheet, just return None, since published
worksheets must not have any compute functionality.

OUTPUT:
    a Sage interface

check_comp(self, wait=0.2)

source code 

        Check on currently computing cells in the queue.

        INPUT:
            wait -- float (default: 0.2); how long to wait for output.

        EXAMPLES:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
            sage: W = nb.create_new_worksheet('Test', 'sage')
            sage: W.edit_save('Sage
{{{
3^20
}}}')
            sage: W.cell_list()[0].evaluate()
            sage: W.check_comp()     # random output -- depends on computer speed
            ('d', Cell 0; in=3^20, out=
            3486784401
            )
            sage: nb.delete()
        

interrupt(self)

source code 

        Interrupt all currently queued up calculations.

        OUTPUT:
            bool -- return True if no problems interrupting calculation
                    return False if the Sage interpreter had to be restarted.

        EXAMPLES:
        We create a worksheet and start a large factorization going:
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
            sage: W = nb.create_new_worksheet('Test', 'sage')
            sage: W.edit_save('Sage
{{{
factor(2^997-1)
}}}')
            sage: W.cell_list()[0].evaluate()

        It's running still
            sage: W.check_comp()
            ('w', Cell 0; in=factor(2^997-1), out=...)

        We interrupt it successfully. 
            sage: W.interrupt()         # random -- could fail on heavily loaded machine
            True

        Now we check and nothing is computing.
            sage: W.check_comp()        # random -- could fail on heavily loaded machine  
            ('e', None)

        Clean up.
            sage: nb.delete()
        

quit_if_idle(self, timeout)

source code 

Quit the worksheet process if it has been ``idle'' for more than \var{timeout} seconds,
where idle is by definition that the worksheet has not reported back that it
is actually computing.  I.e., an ignored worksheet process (since the user closed
their browser) is also considered idle, even if code is running. 

enqueue(self, C, username=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., next=False)

source code 

Queue up the cell C for evaluation in this worksheet.

INPUT:
    C -- a Cell
    username -- the name of the user that is evaluating this
                cell (mainly used for loging)

NOTE: If \code{C.is_asap()} is True, then we put C as close to
the beginning of the queue as possible, but after all asap cells.
Otherwise, C goes at the end of the queue.

delete_cell_input_files(self)

source code 

Delete all the files \file{code_\%s.py} and \file{code_\%s.spyx} that are created
when evaluating cells.  We do this when we first start the notebook
to get rid of clutter. 

check_cell(self, id)

source code 

Check the status on computation of the cell with given id.

INPUT:
    id -- an integer

OUTPUT:
    status -- a string, either 'd' (done) or 'w' (working)
    cell -- the cell with given id

delete_all_output(self, username)

source code 

        Delete all the output in all the worksheet cells.

        INPUT:
            username -- name of the user requesting the deletion.
            
        EXAMPLES:
        We create a new notebook, user, and a worksheet with one cell.
            sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: nb.add_user('sage','sage','sage@sagemath.org',force=True)
            sage: W = nb.create_new_worksheet('Test', 'sage')
            sage: W.edit_save('Sage
system:sage
{{{
2+3
///
5
}}}')

        Notice that there is 1 cell with 5 in its output.
            sage: W.cell_list()
            [Cell 0; in=2+3, out=5]

        We now delete the output, observe that it is gone.
            sage: W.delete_all_output('sage')
            sage: W.cell_list()
            [Cell 0; in=2+3, out=]

        If an invalid user tries to delete all, a ValueError is raised. 
            sage: W.delete_all_output('hacker')
            Traceback (most recent call last):
            ...
            ValueError: user 'hacker' not allowed to edit this worksheet

        Clean up.
            sage: nb.delete()