|
|
|
|
@ -98,8 +98,8 @@ class ContentsHandler(APIHandler):
|
|
|
|
|
self.set_header('Content-Type', 'application/json')
|
|
|
|
|
self.finish(json.dumps(model, default=date_default))
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def get(self, path=''):
|
|
|
|
|
"""Return a model for a file or directory.
|
|
|
|
|
@ -130,8 +130,8 @@ class ContentsHandler(APIHandler):
|
|
|
|
|
validate_model(model, expect_content=content)
|
|
|
|
|
self._finish_model(model, location=False)
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def patch(self, path=''):
|
|
|
|
|
"""PATCH renames a file or directory without re-uploading content."""
|
|
|
|
|
@ -181,8 +181,8 @@ class ContentsHandler(APIHandler):
|
|
|
|
|
validate_model(model, expect_content=False)
|
|
|
|
|
self._finish_model(model)
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def post(self, path=''):
|
|
|
|
|
"""Create a new file in the specified path.
|
|
|
|
|
@ -217,8 +217,8 @@ class ContentsHandler(APIHandler):
|
|
|
|
|
else:
|
|
|
|
|
yield self._new_untitled(path)
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def put(self, path=''):
|
|
|
|
|
"""Saves the file in the location specified by name and path.
|
|
|
|
|
@ -243,8 +243,8 @@ class ContentsHandler(APIHandler):
|
|
|
|
|
else:
|
|
|
|
|
yield gen.maybe_future(self._new_untitled(path))
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def delete(self, path=''):
|
|
|
|
|
"""delete a file in the given path"""
|
|
|
|
|
@ -257,8 +257,8 @@ class ContentsHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
class CheckpointsHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def get(self, path=''):
|
|
|
|
|
"""get lists checkpoints for a file"""
|
|
|
|
|
@ -267,8 +267,8 @@ class CheckpointsHandler(APIHandler):
|
|
|
|
|
data = json.dumps(checkpoints, default=date_default)
|
|
|
|
|
self.finish(data)
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def post(self, path=''):
|
|
|
|
|
"""post creates a new checkpoint"""
|
|
|
|
|
@ -284,8 +284,8 @@ class CheckpointsHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
class ModifyCheckpointsHandler(APIHandler):
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def post(self, path, checkpoint_id):
|
|
|
|
|
"""post restores a file from a checkpoint"""
|
|
|
|
|
@ -294,8 +294,8 @@ class ModifyCheckpointsHandler(APIHandler):
|
|
|
|
|
self.set_status(204)
|
|
|
|
|
self.finish()
|
|
|
|
|
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@json_errors
|
|
|
|
|
@web.authenticated
|
|
|
|
|
@gen.coroutine
|
|
|
|
|
def delete(self, path, checkpoint_id):
|
|
|
|
|
"""delete clears a checkpoint for a given file"""
|
|
|
|
|
|