Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2009-12-24 11:28:36
Size: 1935
Editor: Minh Nguyen
Comment: the Sage notebook belongs to Sage development, so put this page under devel/
Revision 6 as of 2022-04-05 02:11:53
Size: 0
Editor: mkoeppe
Comment: outdated sagenb
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from SageNotebook
= The Sage Notebook Server: A Technical Overview =

This document gives a technical overview of the new Sage Notebook server, including how it responds to user requests, delegates tasks, etc. See [[http://trac.sagemath.org/sage_trac/ticket/6983 | #6983]] for instructions on trying out the new server.

Serving up pages

 * All access goes through `guard.py`.

 * `locateChild` checks authentication.

 * If the user is authenticated, `locateResource` is called to get the appropriate page.

 * `locateResource`, in turn, uses the `LoginSystem` class in `avatars.py` to get the appropriate resource.

 * `LoginSystem` calls the appropriate function in `twist.py`.

 * Which would be `AdminTopLevel`, `UserTopLevel`, `FailedTopLevel`, or `AnonymousTopLevel`, depending on the user type.

 * The `*TopLevel` resources generate child resources based on their `childFactory` methods.

 * Each resource represents a segment of the URL.

 * Thus `'/'` is the `TopLevel` resource, and `'/home/'` is mapped to the `Worksheets` resource, etc.

 * The tree is traversed until a leaf is reached, then the leaf's `render` method is called.

Cell Evaluation

 * Evaluation occurs when `Worksheet_eval` is called.

 * Evaluation only happens if the user has permissions to evaluate the cell.

 * The cell's `evaluate` method is called.

 * `evaluate` adds itself to the worksheet's job queue using `Worksheet#enqueue`, which also calls `Worksheet#start_next_comp`.

 * If the cell is marked for introspection, set `input` to be evaluated to the part before introspection is requested. Otherwise, set `input` to the whole cell.
 
 * Get a reference to an instance of Sage for computation using `Worksheet#sage`. Currently, `WorksheetProcess_ExpectImplementation` from `interfaces/expect.py` is used.

 * Executes `input` with that instance.

 * Updates cell content.