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 | """ |
---|
9 | if self.environ.shouldPurge(): |
---|
10 | self._purgeProperties() |
---|
11 | self._purgeObjects() |
---|
12 | self._purgeIndexes() |
---|
13 | self._purgeColumns() |
---|
14 | ## self._initProperties(node) |
---|
15 | ## self._initObjects(node) |
---|
16 | ## self._initIndexes(node) |
---|
17 | ## self._initColumns(node) |
---|
18 | columns = [] |
---|
19 | for col in self._extractColumns()._get_childNodes(): |
---|
20 | columns.append(col.attributes.items()[0][1]) |
---|
21 | #print "cols: ",columns |
---|
22 | inds = {} |
---|
23 | for ind in self._extractIndexes()._get_childNodes(): |
---|
24 | inds[ind.attributes.items()[1][1]] = ind.attributes.items()[0][1] |
---|
25 | #print ind.attributes.items() |
---|
26 | #print "indexes: ", inds |
---|
27 | na = node.attributes.items() |
---|
28 | not_found = True |
---|
29 | if na[1][1] == "portal_catalog": |
---|
30 | not_found = False |
---|
31 | print na[1][1] |
---|
32 | for ch in node._get_childNodes(): |
---|
33 | if ch.nodeName in ('index',): |
---|
34 | cha = ch.attributes.items() |
---|
35 | iname = cha[1][1] |
---|
36 | itype = cha[0][1] |
---|
37 | if iname in inds.keys() and inds[iname] == itype: |
---|
38 | continue |
---|
39 | elif ch.nodeName in ('column',): |
---|
40 | cha = ch.attributes.items() |
---|
41 | iname = cha[0][1] |
---|
42 | if iname in columns: |
---|
43 | continue |
---|
44 | else: |
---|
45 | continue |
---|
46 | not_found = True |
---|
47 | if not_found: |
---|
48 | self._initProperties(node) |
---|
49 | self._initObjects(node) |
---|
50 | self._initIndexes(node) |
---|
51 | self._initColumns(node) |
---|
52 | self._refreshCatalog() |
---|
53 | |
---|
54 | self._logger.info("Catalog tool imported.") |
---|
55 | |
---|
56 | from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter |
---|
57 | CatalogToolXMLAdapter._importNode = _importNode |
---|