diff --git a/scribeengine/controllers/media.py b/scribeengine/controllers/media.py index 405002c..2460efe 100644 --- a/scribeengine/controllers/media.py +++ b/scribeengine/controllers/media.py @@ -70,3 +70,17 @@ class MediaController(BaseController): c.files = self._get_files(path) #return pformat(c.directories, indent=2) return render(u'/media/index.mako') + + def create_directory(self): + """ + Create a directory, called via AJAX. + """ + dirname = request.GET.get(u'directory') + parent = request.GET.get(u'parent') + if dirname and parent: + parent = os.path.abspath(parent) + os.makedirs(os.path.join(parent, dirname)) + return u'1' + else: + return u'0' +