Back to index

plone3  3.1.7
Private Member Functions | Static Private Attributes
Archetypes.exportimport.archetypetool.ArchetypeToolXMLAdapter Class Reference
Inheritance diagram for Archetypes.exportimport.archetypetool.ArchetypeToolXMLAdapter:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.exportimport.archetypetool.ArchetypeToolXMLAdapter:
Collaboration graph
[legend]

List of all members.

Private Member Functions

def _exportNode
def _importNode
def _purgeCatalogSettings
def _initCatalogSettings
def _extractCatalogSettings

Static Private Attributes

 __used_for__ = IArchetypeTool

Detailed Description

Mode in- and exporter for ArchetypesTool.

Definition at line 11 of file archetypetool.py.


Member Function Documentation

Export the object as a DOM node.

Definition at line 17 of file archetypetool.py.

00017 
00018     def _exportNode(self):
00019         """Export the object as a DOM node.
00020         """
00021         node=self._doc.createElement('archetypetool')
00022         node.appendChild(self._extractCatalogSettings())
00023 
00024         self._logger.info('ArchetypeTool settings exported.')
00025         return node
00026 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 53 of file archetypetool.py.

00053 
00054     def _extractCatalogSettings(self):
00055         node=self._doc.createElement('catalogmap')
00056         for type in self.context.listRegisteredTypes(True):
00057             child=self._doc.createElement('type')
00058             child.setAttribute('portal_type', type['name'])
00059             for cat in self.context.getCatalogsByType(type['name']):
00060                 sub=self._doc.createElement('catalog')
00061                 sub.setAttribute('value', cat.id)
00062                 child.appendChild(sub)
00063             node.appendChild(child)
00064 
00065         return node
00066 

Here is the caller graph for this function:

Definition at line 27 of file archetypetool.py.

00027 
00028     def _importNode(self, node):
00029         if self.environ.shouldPurge():
00030             self._purgeCatalogSettings()
00031 
00032         self._initCatalogSettings(node)
00033         self._logger.info('ArchetypeTool settings imported.')
00034     
00035 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 40 of file archetypetool.py.

00040 
00041     def _initCatalogSettings(self, node):
00042         for child in node.childNodes:
00043             if child.nodeName=='catalogmap':
00044                 for type in child.getElementsByTagName('type'):
00045                     portaltype=type.getAttribute('portal_type')
00046                     catalogs=[e.getAttribute('value') \
00047                               for e in type.getElementsByTagName('catalog')]
00048                     already = [cat.getId() for cat in
00049                                self.context.getCatalogsByType(portaltype)]
00050                     catalogs=Set(catalogs + already)
00051                     self.context.setCatalogsByType(portaltype, list(catalogs))
00052 

Here is the caller graph for this function:

Definition at line 36 of file archetypetool.py.

00036 
00037     def _purgeCatalogSettings(self):
00038         self.context.catalog_map.clear()
00039 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 15 of file archetypetool.py.


The documentation for this class was generated from the following file: