Added an initial "create directory" method.

This commit is contained in:
Raoul Snyman 2010-04-30 15:08:35 +02:00
parent 310cff88bc
commit 9af09feef5

View File

@ -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'