#from Products.CMFCore.utils import getToolByName #from zope.app import zapi #from Products.GenericSetup.interfaces import INode #import Products def _importNode(self, node): """Import the object from the DOM node. """ #import pdb;pdb.set_trace() if self.environ.shouldPurge(): self._purgeProperties() self._purgeObjects() self._purgeIndexes() self._purgeColumns() columns = [] for col in self._extractColumns()._get_childNodes(): columns.append(col.attributes.items()[0][1]) #print "cols: ",columns inds = {} for ind in self._extractIndexes()._get_childNodes(): inds[ind.attributes.items()[1][1]] = ind.attributes.items()[0][1] #print ind.attributes.items() #from pdb import set_trace; set_trace() na = node.attributes.items() not_found = True new_indexes = [] new_columns = [] if na[0][1] in ("CMF Catalog","WAeUP Table"): #print na[1][1] not_found = False for ch in node._get_childNodes(): if ch.nodeName in ('index',): cha = ch.attributes.items() iname = cha[1][1] itype = cha[0][1] if iname in inds.keys() and inds[iname] == itype: continue new_indexes.append(iname) elif ch.nodeName in ('column',): cha = ch.attributes.items() iname = cha[0][1] if iname in columns: continue new_columns.append(iname) else: continue not_found = True if not_found: self._logger.info("%s modified." % na[1][1]) #self._initProperties(node) #self._initObjects(node) if new_indexes and len(self.context()) == 0: #disable creation of new indexes if records in the table self._initIndexes(node) self._initColumns(node) #self._refreshCatalog() self._logger.info("Catalog tool %s imported." % na[1][1]) from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter CatalogToolXMLAdapter._importNode = _importNode