Back to index

plone3  3.1.7
Static Public Attributes | Private Member Functions
CMFDiffTool.exportimport.difftool.DiffToolXMLAdapter Class Reference
Inheritance diagram for CMFDiffTool.exportimport.difftool.DiffToolXMLAdapter:
Inheritance graph
[legend]
Collaboration diagram for CMFDiffTool.exportimport.difftool.DiffToolXMLAdapter:
Collaboration graph
[legend]

List of all members.

Static Public Attributes

string name = 'diff_tool'

Private Member Functions

def _exportNode
def _importNode
def _purgeDiffToolSettings
def _initDiffToolSettings
def _extractDiffToolSettings

Detailed Description

In- and exporter for DiffTool.

Definition at line 9 of file difftool.py.


Member Function Documentation

Export the object as a DOM node.

Definition at line 16 of file difftool.py.

00016 
00017     def _exportNode(self):
00018         """Export the object as a DOM node.
00019         """
00020         node=self._doc.createElement("object")
00021         node.appendChild(self._extractDiffToolSettings())
00022 
00023         self._logger.info("DiffTool settings exported.")
00024         return node

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 48 of file difftool.py.

00048 
00049     def _extractDiffToolSettings(self):
00050         node=self._doc.createElement("difftypes")
00051         ttool = getToolByName(self.context, "portal_types")
00052         for ptype in ttool.listContentTypes():
00053             diffs = self.context.getDiffForPortalType(ptype)
00054             if diffs:
00055                 child=self._doc.createElement("type")
00056                 child.setAttribute("portal_type", ptype)
00057                 node.appendChild(child)
00058             for field_name, diff in diffs.items():
00059                 field=self._doc.createElement("field")
00060                 field.setAttribute("name", field_name)
00061                 field.setAttribute("difftype", diff)
00062                 child.appendChild(field)
00063         return node
00064 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 25 of file difftool.py.

00025 
00026     def _importNode(self, node):
00027         if self.environ.shouldPurge():
00028             self._purgeDiffToolSettings()
00029 
00030         self._initDiffToolSettings(node)
00031         self._logger.info("DiffTool settings imported.")

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 35 of file difftool.py.

00035 
00036     def _initDiffToolSettings(self, node):
00037         for child in node.childNodes:
00038             if child.nodeName == "difftypes":
00039                 for type_entry in child.getElementsByTagName("type"):
00040                     ptype = type_entry.getAttribute("portal_type")
00041                     fields = {}
00042                     for field in type_entry.getElementsByTagName("field"):
00043                         name = field.getAttribute("name")
00044                         diff = field.getAttribute("difftype")
00045                         fields[name] = diff
00046                         self.context.setDiffForPortalType(ptype, fields)
00047 

Here is the caller graph for this function:

Definition at line 32 of file difftool.py.

00032 
00033     def _purgeDiffToolSettings(self):
00034         self.context.manage_editDiffFields({})

Here is the caller graph for this function:


Member Data Documentation

Definition at line 14 of file difftool.py.


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