Commit 41ddb164 authored by Sebastian's avatar Sebastian

Add: more accidentally removed jupyter API code

parent 3b9cb155
......@@ -198,10 +198,46 @@ define(function(require) {
return this.get(path, {type: 'directory'});
};
/**
*
*
* Default jupyter API endpoint config (taken from the standard contents manager)
*
*
*/
var Contents = function(options) {
this.base_url = options.base_url;
};
this.base_url = options.base_url;
};
/** Error type */
Contents.DIRECTORY_NOT_EMPTY_ERROR = 'DirectoryNotEmptyError';
Contents.DirectoryNotEmptyError = function() {
this.message = 'A directory must be empty before being deleted.';
};
Contents.DirectoryNotEmptyError.prototype =
Object.create(Error.prototype);
Contents.DirectoryNotEmptyError.prototype.name =
Contents.DIRECTORY_NOT_EMPTY_ERROR;
Contents.prototype.api_url = function() {
var url_parts = [
this.base_url, 'api/contents',
utils.url_join_encode.apply(null, arguments),
];
return utils.url_path_join.apply(null, url_parts);
};
Contents.prototype.create_basic_error_handler = function(callback) {
if (!callback) {
return utils.log_ajax_error;
}
return function(xhr, status, error) {
callback(utils.wrap_ajax_error(xhr, status, error));
};
};
return {'Contents': Contents};
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment