make export a bit more resilient. If there's a piece of metadata that we can't serialize - i.e. someone wrote a new bool attribute and didn't put it in the type mapping table - then we log the exception and continue.

This commit is contained in:
Chris Dodge
2013-03-07 10:43:36 -05:00
parent 1b7863e79e
commit 9ba759802c
2 changed files with 31 additions and 1 deletions

View File

@@ -379,7 +379,11 @@ class XmlDescriptor(XModuleDescriptor):
if attr not in self.metadata_to_strip and attr not in self.metadata_to_export_to_policy:
val = val_for_xml(attr)
#logging.debug('location.category = {0}, attr = {1}'.format(self.location.category, attr))
xml_object.set(attr, val)
try:
xml_object.set(attr, val)
except Exception, e:
logging.exception('Failed to serialize metadata attribute {0} with value {1}. This could mean data loss!!! Exception: {2}'.format(attr, val, e))
pass
if self.export_to_file():
# Write the definition to a file