Commit fe050459 authored by asseldonk's avatar asseldonk
Browse files

added shutil.move(source, destination)

parent 65f3e741
......@@ -155,6 +155,18 @@ class FSAjaxController(AbstractController):
# so convert it with the convert function
fs.remove(path)
@cherrypy.expose
@cherrypy.tools.ajax()
def move(self, source, destination):
self.release_session()
fs = self.get('fs')
self.release_database()
source = json.loads(source)
destination = json.loads(destination)
# 'source' and 'destination' can be a unicode/string or list of unicodes/strings
# so convert it with the convert function
fs.move(source, destination)
@cherrypy.expose
@cherrypy.tools.ajax()
def compress(self, path, paths, name):
......
......@@ -286,6 +286,12 @@ class FileSystem(object):
else:
os.remove(path)
def move(self, source, destination):
source = self.expand(source)
destination = self.expand(destination)
if os.path.isdir(destination):
shutil.move(source, destination)
def compress(self, path, paths, name):
# paths has to be a list of strings
paths = paths if isinstance(paths, (list, tuple)) else [paths]
......
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