[445] | 1 | #from Products.CMFCore.utils import getToolByName |
---|
| 2 | #from zope.app import zapi |
---|
| 3 | #from Products.GenericSetup.interfaces import INode |
---|
| 4 | #import Products |
---|
| 5 | |
---|
| 6 | def _importNode(self, node): |
---|
| 7 | """Import the object from the DOM node. |
---|
| 8 | """ |
---|
[502] | 9 | #import pdb;pdb.set_trace() |
---|
[445] | 10 | if self.environ.shouldPurge(): |
---|
| 11 | self._purgeProperties() |
---|
| 12 | self._purgeObjects() |
---|
| 13 | self._purgeIndexes() |
---|
| 14 | self._purgeColumns() |
---|
| 15 | columns = [] |
---|
| 16 | for col in self._extractColumns()._get_childNodes(): |
---|
| 17 | columns.append(col.attributes.items()[0][1]) |
---|
| 18 | #print "cols: ",columns |
---|
| 19 | inds = {} |
---|
| 20 | for ind in self._extractIndexes()._get_childNodes(): |
---|
| 21 | inds[ind.attributes.items()[1][1]] = ind.attributes.items()[0][1] |
---|
| 22 | #print ind.attributes.items() |
---|
| 23 | #print "indexes: ", inds |
---|
| 24 | na = node.attributes.items() |
---|
| 25 | not_found = True |
---|
[502] | 26 | if na[0][1] == "CMF Catalog": |
---|
[445] | 27 | not_found = False |
---|
[502] | 28 | #print na[1][1] |
---|
[445] | 29 | for ch in node._get_childNodes(): |
---|
| 30 | if ch.nodeName in ('index',): |
---|
| 31 | cha = ch.attributes.items() |
---|
| 32 | iname = cha[1][1] |
---|
| 33 | itype = cha[0][1] |
---|
| 34 | if iname in inds.keys() and inds[iname] == itype: |
---|
| 35 | continue |
---|
| 36 | elif ch.nodeName in ('column',): |
---|
| 37 | cha = ch.attributes.items() |
---|
| 38 | iname = cha[0][1] |
---|
| 39 | if iname in columns: |
---|
| 40 | continue |
---|
| 41 | else: |
---|
| 42 | continue |
---|
| 43 | not_found = True |
---|
| 44 | if not_found: |
---|
[537] | 45 | #self._initProperties(node) |
---|
| 46 | #self._initObjects(node) |
---|
| 47 | #self._initIndexes(node) |
---|
| 48 | #self._initColumns(node) |
---|
[445] | 49 | self._refreshCatalog() |
---|
| 50 | |
---|
| 51 | self._logger.info("Catalog tool imported.") |
---|
| 52 | |
---|
| 53 | from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter |
---|
| 54 | CatalogToolXMLAdapter._importNode = _importNode |
---|