Back to index

plone3  3.1.7
Static Public Attributes | Private Member Functions | Static Private Attributes
CMFCore.exportimport.contenttyperegistry.ContentTypeRegistryXMLAdapter Class Reference
Inheritance diagram for CMFCore.exportimport.contenttyperegistry.ContentTypeRegistryXMLAdapter:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.exportimport.contenttyperegistry.ContentTypeRegistryXMLAdapter:
Collaboration graph
[legend]

List of all members.

Static Public Attributes

string name = 'contenttyperegistry'

Private Member Functions

def _exportNode
def _importNode
def _extractPredicates
def _purgePredicates
def _initPredicates
def _crackArgs

Static Private Attributes

string _LOGGER_ID = 'contenttypes'
dictionary _KNOWN_PREDICATE_TYPES

Detailed Description

XML im- and exporter for ContentTypeRegistry.

Definition at line 29 of file contenttyperegistry.py.


Member Function Documentation

Definition at line 104 of file contenttyperegistry.py.

00104 
00105     def _crackArgs(self, predicate):
00106         cracker = self._KNOWN_PREDICATE_TYPES.get(predicate.PREDICATE_TYPE)
00107         if cracker is not None:
00108             return cracker(predicate)
00109         return ()  # XXX:  raise?
00110 

Here is the caller graph for this function:

Export the object as a DOM node.

Definition at line 40 of file contenttyperegistry.py.

00040 
00041     def _exportNode(self):
00042         """Export the object as a DOM node.
00043         """
00044         node = self._getObjectNode('object')
00045         node.appendChild(self._extractPredicates())
00046 
00047         self._logger.info('Content type registry exported.')
00048         return node

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 59 of file contenttyperegistry.py.

00059 
00060     def _extractPredicates(self):
00061         fragment = self._doc.createDocumentFragment()
00062         for predicate_id, info in self.context.listPredicates():
00063             child = self._doc.createElement('predicate')
00064             child.setAttribute('name', predicate_id)
00065             child.setAttribute('predicate_type', info[0].PREDICATE_TYPE)
00066             child.setAttribute('content_type_name', info[1])
00067             for argument in self._crackArgs(info[0]):
00068                 sub = self._doc.createElement('argument')
00069                 sub.setAttribute('value', argument)
00070                 child.appendChild(sub)
00071             fragment.appendChild(child)
00072         return fragment

Here is the call graph for this function:

Here is the caller graph for this function:

Import the object from the DOM node.

Definition at line 49 of file contenttyperegistry.py.

00049 
00050     def _importNode(self, node):
00051         """Import the object from the DOM node.
00052         """
00053         if self.environ.shouldPurge():
00054             self._purgePredicates()
00055 
00056         self._initPredicates(node)
00057 
00058         self._logger.info('Content type registry imported.')

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 76 of file contenttyperegistry.py.

00076 
00077     def _initPredicates(self, node):
00078         for child in node.childNodes:
00079             if child.nodeName != 'predicate':
00080                 continue
00081             parent = self.context
00082 
00083             predicate_id = str(child.getAttribute('name'))
00084             predicate_type = str(child.getAttribute('predicate_type'))
00085             content_type_name = str(child.getAttribute('content_type_name'))
00086             if predicate_id not in parent.predicate_ids:
00087                 parent.addPredicate(predicate_id, predicate_type)
00088 
00089             arguments = []
00090             for sub in child.childNodes:
00091                 if sub.nodeName != 'argument':
00092                     continue
00093                 arguments.append(str(sub.getAttribute('value')))
00094             parent.getPredicate(predicate_id).edit(*arguments)
00095             parent.assignTypeName(predicate_id, content_type_name)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 73 of file contenttyperegistry.py.

00073 
00074     def _purgePredicates(self):
00075         self.context.__init__()

Here is the caller graph for this function:


Member Data Documentation

Initial value:
{
        'major_minor': lambda x: (','.join(x.major or ()),
                                  ','.join(x.minor or ())),
        'extension': lambda x: (','.join(x.extensions or ()),),
        'mimetype_regex': lambda x: (x.pattern and x.pattern.pattern or '',),
        'name_regex': lambda x: (x.pattern and x.pattern.pattern or '',),
    }

Definition at line 96 of file contenttyperegistry.py.

Definition at line 36 of file contenttyperegistry.py.

Definition at line 38 of file contenttyperegistry.py.


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