Merge pull request #1258 from MITx/fix/cdodge/export-create-recursive-folders

the parent directory might not already exist, so we have to call makedir...
This commit is contained in:
Don Mitchell
2013-01-10 11:46:21 -08:00

View File

@@ -379,7 +379,7 @@ class XmlDescriptor(XModuleDescriptor):
# Write the definition to a file
url_path = name_to_pathname(self.url_name)
filepath = self.__class__._format_filepath(self.category, url_path)
resource_fs.makedir(os.path.dirname(filepath), allow_recreate=True)
resource_fs.makedir(os.path.dirname(filepath), recursive=True, allow_recreate=True)
with resource_fs.open(filepath, 'w') as file:
file.write(etree.tostring(xml_object, pretty_print=True, encoding='utf-8'))