From: Andreas J. <aj...@pr...> - 2004-01-30 19:18:08
|
Update of /cvsroot/collective/PloneLocalFolderNG In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22756 Modified Files: PloneLocalFolderNG.py Log Message: added mkdir support Index: PloneLocalFolderNG.py =================================================================== RCS file: /cvsroot/collective/PloneLocalFolderNG/PloneLocalFolderNG.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- PloneLocalFolderNG.py 20 Dec 2003 13:13:57 -0000 1.16 +++ PloneLocalFolderNG.py 30 Jan 2004 19:16:28 -0000 1.17 @@ -238,6 +238,23 @@ open(filename + '.metadata', 'wb').write(comment) REQUEST.RESPONSE.redirect('/' + os.path.join(self.absolute_url(1), rel_dir, 'plfng_view')) + security.declareProtected(ModifyPortalContent, 'create_directory') + def create_directory(self, dirname, REQUEST): + """ upload a file """ + + rel_dir = '/'.join(REQUEST.get('_e', [])) + destpath = os.path.join(self.folder, rel_dir, dirname) + print destpath + if os.path.exists(destpath): + raise ValueError('Directory %s already exists' % dirname) + + try: + os.makedirs(destpath) # try..except to avoid exposing the realword path + except: + raise RuntimeError('Directory could not be created') + + url = '/' + os.path.join(self.absolute_url(1), rel_dir, dirname) + '/plfng_view?portal_status_message=Directory created' + REQUEST.RESPONSE.redirect(url) def modify_fti(fti): # hide unnecessary tabs (usability enhancement) |