Module: sage.server.notebook.twist
The Sage Notebook Twisted Web Server
Module-level Functions
pass1, pass2) |
sage: from sage.server.notebook.twist import do_passwords_match sage: do_passwords_match('momcat', 'mothercat') False sage: do_passwords_match('mothercat', 'mothercat') True
) |
v) |
html_page) |
) |
email) |
from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65215
sage: from sage.server.notebook.twist import is_valid_email sage: is_valid_email('joe@washinton.gov') True sage: is_valid_email('joe.washington.gov') False
password, username) |
Return True if and only if password is valid, i.e., is between 6 and 32 characters long, doesn't contain space(s), and doesn't contain username.
sage: from sage.server.notebook.twist import is_valid_password sage: is_valid_password('uip@un7!', None) True sage: is_valid_password('markusup89', None) True sage: is_valid_password('8u7', None) False sage: is_valid_password('fUmDagaz8LmtonAowjSe0Pvu9C5Gvr6eKcC6wsAT', None) False sage: is_valid_password('rrcF !u78!', None) False sage: is_valid_password('markusup89', 'markus') False
username) |
Returns True if and only if username is valid, i.e., starts with a letter, is between 4 and 32 characters long, and contains only letters, numbers, underscores, and and one dot (.).
sage: from sage.server.notebook.twist import is_valid_username
username must start with a letter
sage: is_valid_username('mark10') True sage: is_valid_username('10mark') False
username must be between 4 and 32 characters long
sage: is_valid_username('bob') False sage: is_valid_username('I_love_computer_science_and_maths') #33 characters long False
username must not have more than one dot (.)
sage: is_valid_username('david.andrews') True sage: is_valid_username('david.m.andrews') False sage: is_valid_username('math125.TA.5') False
username must not have any spaces
sage: is_valid_username('David Andrews') False sage: is_valid_username('David M. Andrews') False
sage: is_valid_username('sarah_andrews') True
sage: is_valid_username('TA-1') False sage: is_valid_username('math125-TA') False
sage: is_valid_username('dandrews@sagemath.org') False
msg, [cont=None]) |
) |
) |
) |
url) |
args, pub, username) |
cookie) |
username) |
) |
worksheet, rev, username) |
worksheet, rev, username) |
Class: AddWorksheet
Functions: render
Class: AdminToplevel
Functions: render
Class: AnonymousToplevel
Functions: render,
userchildFactory
Class: CellData
self, worksheet, number) |
Functions: childFactory,
render
Special Functions: __init__
Class: CSS
Functions: childFactory,
render
Class: Doc
self, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: DocLive
self, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: DocStatic
Functions: childFactory,
render
Class: EmptyTrash
self, username) |
This twisted resource empties the trash of the current user when it is rendered.
We create an instance of this resource.
sage: E = sage.server.notebook.twist.EmptyTrash('sage'); E <sage.server.notebook.twist.EmptyTrash object at ...>
Functions: render
self, ctx) |
Rendering this resource (1) empties the trash, and (2) returns a message.
We create a notebook with a worksheet, put it in the trash, then empty the trash by creating and rendering this worksheet.
sage: n = sage.server.notebook.notebook.Notebook('notebook-test') sage: n.add_user('sage','sage','sage@sagemath.org',force=True) sage: W = n.new_worksheet_with_title_from_text('Sage', owner='sage') sage: W.move_to_trash('sage') sage: n.worksheet_names() ['sage/0'] sage: sage.server.notebook.twist.notebook = n sage: E = sage.server.notebook.twist.EmptyTrash('sage'); E <sage.server.notebook.twist.EmptyTrash object at ...> sage: E.render(None) <twisted.web2.http.Response code=200, streamlen=603>
Finally we verify that the trashed worksheet is gone:
sage: n.worksheet_names() [] sage: n.delete()
Special Functions: __init__
Class: FailedToplevel
self, info, problem, [username=None]) |
Functions: render
Special Functions: __init__
Class: ForgotPassPage
Functions: render
Class: Help
self, username) |
Functions: render
Special Functions: __init__
Class: History
self, username) |
Functions: render
Special Functions: __init__
Class: Images
Functions: childFactory,
render
Class: InvalidPage
self, msg, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: Java
Functions: childFactory,
render
Class: Javascript
Functions: childFactory,
render
Class: Keyboard_js
Functions: childFactory
Class: Keyboard_js_specific
self, browser_os) |
Functions: render
Special Functions: __init__
Class: LiveHistory
self, username) |
Functions: render
Special Functions: __init__
Class: LoginResourceClass
Functions: childFactory,
render
Class: Logout
Functions: render
Class: Main_css
Functions: render
Class: Main_js
Functions: render
Class: NewWorksheet
self, username) |
Functions: render
Special Functions: __init__
Class: NotebookConf
Functions: render
Class: NotebookSettings
self, username) |
Functions: render
Special Functions: __init__
Class: NotImplementedWorksheetOp
self, op, ws) |
Functions: render
Special Functions: __init__
Class: ProcessNotebookSettings
Functions: render
Class: ProcessUserSettings
Functions: render
Class: PublicWorksheets
self, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: PublicWorksheetsHome
self, username) |
Functions: childFactor
Special Functions: __init__
Class: PublishWorksheetRevision
self, worksheet, rev) |
Functions: render
Special Functions: __init__
Class: RedirectLogin
Functions: childFactory,
render
Class: RegConfirmation
Functions: render
Class: RegistrationPage
self, userdb) |
Functions: render
Special Functions: __init__
Class: Reset_css
Functions: render
Class: RevertToWorksheetRevision
self, worksheet, rev) |
Functions: render
Special Functions: __init__
Class: SageTex
self, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: SendWorksheetToActive
Functions: action
Class: SendWorksheetToArchive
Functions: action
Class: SendWorksheetToFolder
self, username) |
Functions: action,
render
Special Functions: __init__
Class: SendWorksheetToStop
Functions: action
Class: SendWorksheetToTrash
Functions: action
Class: SettingsPage
self, username) |
Functions: render
Special Functions: __init__
Class: Slider
Functions: childFactory,
render
Class: Source
self, path, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: SourceBrowser
self, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: Toplevel
self, cookie, username) |
Functions: childFactory,
render,
userchildFactory
Special Functions: __init__
Class: TrivialResource
Functions: render
Class: Upload
Functions: render
Class: UploadWorksheet
self, username) |
Functions: render
Special Functions: __init__
Class: UserToplevel
Functions: render,
userchildFactory
Class: Worksheet
Functions: childFactory,
render
Class: Worksheet_alive
Functions: render
Class: Worksheet_cell_update
Functions: render
Class: Worksheet_cells
Functions: childFactory,
render
Class: Worksheet_conf
Functions: render
Class: Worksheet_copy
Functions: render
Class: Worksheet_data
Functions: childFactory,
render
Class: Worksheet_datafile
Functions: render
Class: Worksheet_delete_all_output
Functions: render
Class: Worksheet_delete_cell
If there is only one cell left in a given worksheet, the request to delete that cell is ignored because there must be a least one cell at all times in a worksheet. (This requirement exists so other functions that evaluate relative to existing cells will still work, and so one can add new cells.)
Functions: render
Class: Worksheet_discard_and_quit
Functions: render
Class: Worksheet_do_upload_data
Functions: render
Class: Worksheet_download
Functions: childFactory
Class: Worksheet_edit
Functions: render
Class: Worksheet_edit_published_page
Functions: render
Class: Worksheet_eval
If the request is not authorized (the requester did not enter the correct password for the given worksheet), then the request to evaluate or introspect the cell is ignored.
If the cell contains either 1 or 2 question marks at the end (not on a comment line), then this is interpreted as a request for either introspection to the documentation of the function, or the documentation of the function and the source code of the function respectively.
Functions: render
Class: Worksheet_hide_all
Functions: render
Class: Worksheet_input_settings
Functions: render
Class: Worksheet_interrupt
Functions: render
Class: Worksheet_introspect
Functions: render
Class: Worksheet_invite_collab
Functions: render
Class: Worksheet_link_datafile
Functions: render
Class: Worksheet_new_cell_after
Functions: render
Class: Worksheet_new_cell_before
Functions: render
Class: Worksheet_plain
Functions: render
Class: Worksheet_pretty_print
Functions: childFactory
Class: Worksheet_print
Functions: render
Class: Worksheet_publish
Functions: render
Class: Worksheet_quit_sage
Functions: render
Class: Worksheet_rate
Functions: render
Class: Worksheet_rating_info
Functions: render
Class: Worksheet_rename
Functions: render
Class: Worksheet_restart_sage
Functions: render
Class: Worksheet_revert_to_last_saved_state
Functions: render
Class: Worksheet_revisions
Functions: render
Class: Worksheet_save
Functions: render
Class: Worksheet_save_and_close
Functions: render
Class: Worksheet_save_and_quit
Functions: render
Class: Worksheet_save_snapshot
Functions: render
Class: Worksheet_savedatafile
Functions: render
Class: Worksheet_set_cell_output_type
This enables the type of output cell, such as to allowing wrapping for output that is very long.
Functions: render
Class: Worksheet_settings
Functions: render
Class: Worksheet_share
Functions: render
Class: Worksheet_show_all
Functions: render
Class: Worksheet_system
Functions: childFactory
Class: Worksheet_text
Functions: render
Class: Worksheet_upload_data
Functions: render
Class: WorksheetFile
self, path, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: WorksheetResource
self, name, username) |
Functions: id
Special Functions: __init__
Class: Worksheets
self, username) |
Functions: childFactory,
render
Special Functions: __init__
Class: WorksheetsAdmin
Functions: childFactory
Class: WorksheetsByUser
self, user, username) |
Functions: childFactory,
render,
render_list
Special Functions: __init__
Class: WorksheetsByUserAdmin
Functions: render
See About this document... for information on suggesting changes.