def devImport(xmlfile): """ Load a new device from a file. @param xmlfile: file type object @type xmlfile: file type object """ im = NoLoginImportRM(target.devices) im.loadObjectFromXML(xmlfile) im.processLinks()
def devImport(xmlfile): """ Load a new device from a file. @param xmlfile: file type object @type xmlfile: file type object """ im = NoLoginImportRM(target.devices) im.loadObjectFromXML(xmlfile) im.processLinks()
def _persistDataSource(self, datasource): """after switching the __class__ attribute, call this function to make the change permanent""" id = datasource.id from cStringIO import StringIO xml_file = StringIO() datasource.exportXml(xml_file) parent = datasource.getPrimaryParent() parent._delObject(datasource.id) from Products.ZenRelations.ImportRM import NoLoginImportRM xml_importer = NoLoginImportRM(parent) xml_file.seek(0) xml_importer.loadObjectFromXML(xml_file) xml_importer.processLinks() ds = parent._getOb(id) notify(IndexingEvent(ds))
def _persistDataSource(self, datasource): """after switching the __class__ attribute, call this function to make the change permanent""" id = datasource.id from cStringIO import StringIO xml_file = StringIO() datasource.exportXml(xml_file) parent = datasource.getPrimaryParent() parent._delObject(datasource.id) from Products.ZenRelations.ImportRM import NoLoginImportRM xml_importer = NoLoginImportRM(parent) xml_file.seek(0) xml_importer.loadObjectFromXML(xml_file) xml_importer.processLinks() ds = parent._getOb(id) notify(IndexingEvent(ds))