Cloning¶
The clone module¶
BookstoreCloneHandler¶
-
class
bookstore.clone.BookstoreCloneHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)¶ Prepares and provides clone options page, populating UI with clone option parameters.
Provides handling for
GETrequests when cloning a notebook from storage (S3). Launches a user interface with cloning options.-
initialize(self)¶ Helper to access bookstore settings.
-
get(self)¶ Checks for valid storage settings and render a UI for clone options.
-
construct_template_params(self, s3_bucket, s3_object_key)¶ Helper to populate Jinja template for cloning option page.
-
get_template(self, name)¶ Loads a Jinja template and its related settings.
-
Methods¶
-
BookstoreCloneHandler.initialize() Helper to retrieve bookstore setting for the session.
-
BookstoreCloneHandler.get() GET /bookstore/clone?s3_bucket=<your_s3_bucket>&s3_key=<your_s3_key>
Renders an options page that will allow you to clone a notebook from a specific bucket via the Bookstore cloning API.
s3_bucket is the bucket you wish to clone from. s3_key is the object key that you wish to clone.
-
BookstoreCloneHandler.construct_template_params(s3_bucket, s3_object_key) Helper that takes valid S3 parameters and populates UI template
Returns: Template parameters in a dictionary Return type: dict
-
BookstoreCloneHandler.get_template(name) Loads a Jinja template by name.
BookstoreCloneAPIHandler¶
-
class
bookstore.clone.BookstoreCloneAPIHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)¶ Handle notebook clone from storage.
Provides API handling for
POSTand clones a notebook from storage (S3).-
initialize(self)¶ Helper to access bookstore settings.
-
post(self)¶ Clone a notebook from the location specified by the payload.
-
Methods¶
-
BookstoreCloneAPIHandler.initialize() Helper to retrieve bookstore setting for the session.
-
BookstoreCloneAPIHandler.post() POST /api/bookstore/clone
Clone a notebook to the path specified in the payload.
The payload type for the request should be:
{ "s3_bucket": string, "s3_key": string, "target_path"?: string }The response payload should match the standard Jupyter contents API POST response.
-
BookstoreCloneAPIHandler.build_post_model_response(model, target_path)¶ Helper that takes constructs a Jupyter Contents API compliant model.
If the file at target_path already exists, this increments the file name.