source: WAeUP_SRP/branches/joachim-azax-branch/PatchCatalogToolXMLAdapter.py @ 15626

Last change on this file since 15626 was 1936, checked in by joachim, 18 years ago

remove debugging output

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1#from Products.CMFCore.utils import getToolByName
2#from zope.app import zapi
3#from Products.GenericSetup.interfaces import INode
4#import Products
5
6def _importNode(self, node):
7    """Import the object from the DOM node.
8    """
9    na = node.attributes.items()
10    something_changed = False
11    new_indexes = []
12    new_columns = []
13    meta_type = na[0][1]
14    name = na[1][1]
15    if self.environ.shouldPurge():
16        self._purgeProperties()
17        self._purgeObjects()
18        self._purgeIndexes()
19        self._purgeColumns()
20    columns = []
21    for col in self._extractColumns()._get_childNodes():
22        columns.append(col.attributes.items()[0][1])
23    inds = {}
24    for ind in self._extractIndexes()._get_childNodes():
25        inds[ind.attributes.items()[1][1]] = ind.attributes.items()[0][1]
26    if meta_type in ('CMF Catalog',"WAeUP Table"):
27        for ch in node._get_childNodes():
28            if ch.nodeName in ('index',):
29                cha = ch.attributes.items()
30                iname = cha[1][1]
31                itype = cha[0][1]
32                if iname in inds.keys() and inds[iname] == itype:
33                    continue
34                new_indexes.append(iname)
35                something_changed = True
36            elif ch.nodeName in ('column',):
37                cha = ch.attributes.items()
38                iname = cha[0][1]
39                if iname in columns:
40                    continue
41                new_columns.append(iname)
42                something_changed = True
43            else:
44                continue
45    if something_changed :
46        self._logger.info("Catalog tool %s cleared."  % na[1][1])
47        self._logger.info("%s modified." % na[1][1])
48        self._initProperties(node)
49        self._initObjects(node)
50        if new_indexes and len(self.context()) == 0: #disable creation of new indexes if records in the table
51            self._initIndexes(node)
52        self._initColumns(node)
53        #self._refreshCatalog()
54
55    self._logger.info("Catalog tool %s imported."  % na[1][1])
56   
57from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter
58CatalogToolXMLAdapter._importNode = _importNode
Note: See TracBrowser for help on using the repository browser.