def process(self, obj): # Create Product Manager and dump orbit pm = ProductManager() pm.configure() pm.dumpProduct(obj, 'test.xml') return pm.loadProduct('test.xml')
def saveProduct(self, obj, xmlname): ''' Save the product to an XML file using Product Manager. ''' from iscesys.Component.ProductManager import ProductManager as PM pm = PM() pm.configure() pm.dumpProduct(obj, xmlname) return None
def saveProduct(obj, xmlname): ''' Save the product to an XML file using Product Manager. ''' # import shelve # import os # with shelve.open(os.path.dirname(xmlname) + '/'+ os.path.basename(xmlname) +'.data') as db: # db['data'] = obj from iscesys.Component.ProductManager import ProductManager as PM pm = PM() pm.configure() pm.dumpProduct(obj, xmlname) return None
def testDump(self): ''' Test Dump and Load ''' # Orbit class instance #print('.Test Dump and Load') # Add StateVectors to orbit for i in range(10): self.stateVectors.append(createFacility()) # Create Product Manager and dump orbit pm = ProductManager() pm.configure() pm.dumpProduct(self.stateVectors, 'test.xml') # Load it back and compare it with the older instance newStateVec = pm.loadProduct('test.xml') self.assertEqual(self.stateVectors, newStateVec)