--- OSAS/OSA_system/addFolder.py 2003/09/25 17:55:50 1.1 +++ OSAS/OSA_system/addFolder.py 2003/10/11 10:54:13 1.2 @@ -6,27 +6,33 @@ from Products.PageTemplates.PageTemplate from Products.PageTemplates.PageTemplate import PageTemplate def addFolder(self,path,folder_name,description,archive_creation_date,creator): + if not os.path.exists(path+"/"+folder_name): os.mkdir(path+"/"+folder_name) os.chmod(path+"/"+folder_name,0775) add_metadata={} - add_metadata['description']=description + + add_metadata['description']=description.decode('latin-1') + add_metadata['archive-creation-date']=archive_creation_date add_metadata['folder_name']=folder_name add_metadata['archive-path']=path - add_metadata['creator']=creator + add_metadata['creator']=creator.decode('latin-1') add_metadata['content-type']="folder" self.REQUEST.SESSION['add_metadata']=add_metadata self.metadataprint="" - - newtemplate=PageTemplateFile('products/OSA_system/index_meta').__of__(self) - newtemplate.content_type="text/xml" + newtemplate=PageTemplateFile('Products/OSA_system/index_meta').__of__(self) + newtemplate.content_type="text/xml" renderxml = newtemplate() + + f=open(add_metadata['archive-path']+"/"+add_metadata['folder_name']+"/index.meta",'w') - f.writelines(renderxml) + + f.write(renderxml.encode('utf8')) f.close() + #return renderxml os.chmod(add_metadata['archive-path']+"/"+add_metadata['folder_name']+"/index.meta",0644) try: self.viewpath=re.search(r"/mpiwg/online/(.*)",add_metadata['archive-path']).group(1)