source: WAeUP_SRP/trunk/PatchCatalogToolXMLAdapter.py @ 494

Last change on this file since 494 was 486, checked in by joachim, 18 years ago

svn -R propset svn:keywords "Id" .
added layout_application_/edit/create/view
and cleaned that up.

  • Property svn:keywords set to Id
File size: 1.9 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    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   
56from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter
57CatalogToolXMLAdapter._importNode = _importNode
Note: See TracBrowser for help on using the repository browser.