#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. """ na = node.attributes.items() not_found = False new_indexes = [] new_columns = [] meta_type = na[0][1] name = na[1][1] print name,meta_type,len(self.context()) if self.environ.shouldPurge(): #import pdb;pdb.set_trace() 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() if meta_type in ("WAeUP Table") and name != "portal_catalog_real": 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) not_found = True elif ch.nodeName in ('column',): cha = ch.attributes.items() iname = cha[0][1] if iname in columns: continue new_columns.append(iname) not_found = True else: continue if not_found : self._logger.info("Catalog tool %s cleared." % na[1][1]) 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 tooool %s imported." % na[1][1]) from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter CatalogToolXMLAdapter._importNode = _importNode