Back to index

plone3  3.1.7
Static Public Attributes | Private Member Functions | Static Private Attributes
plone.browserlayer.exportimport.BrowserLayerXMLAdapter Class Reference
Inheritance diagram for plone.browserlayer.exportimport.BrowserLayerXMLAdapter:
Inheritance graph
[legend]
Collaboration diagram for plone.browserlayer.exportimport.BrowserLayerXMLAdapter:
Collaboration graph
[legend]

List of all members.

Static Public Attributes

string name = 'browserlayer'

Private Member Functions

def _exportNode
def _importNode
def _initProvider
def _purgeLayers
def _initLayers
def _extractLayers

Static Private Attributes

string _LOGGER_ID = 'browserlayer'

Detailed Description

Im- and exporter for local browser layers

Definition at line 23 of file exportimport.py.


Member Function Documentation

Definition at line 32 of file exportimport.py.

00032 
00033     def _exportNode(self):
00034         # hack around an issue where _getObjectNode expects to have the context
00035         # a meta_type and a getId method, which isn't the case for a component
00036         # registry
00037         if IComponentRegistry.providedBy(self.context):
00038             self.context.meta_type = 'ComponentRegistry'
00039             self.context.getId = dummyGetId
00040         node = self._getObjectNode('layers')
00041         if IComponentRegistry.providedBy(self.context):
00042             del(self.context.meta_type)
00043             del(self.context.getId)
00044         node.appendChild(self._extractLayers())
00045         self._logger.info('Browser layers exported')
00046         return node

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 69 of file exportimport.py.

00069 
00070     def _extractLayers(self):
00071         fragment = self._doc.createDocumentFragment()
00072         
00073         registrations = [r for r in self.context.registeredUtilities() 
00074                             if r.provided == ILocalBrowserLayerType]
00075                             
00076         for r in registrations:
00077             child = self._doc.createElement('layer')
00078             child.setAttribute('name', r.name)
00079             child.setAttribute('interface', _getDottedName(r.component))
00080             fragment.appendChild(child)
00081             
00082         return fragment

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 47 of file exportimport.py.

00047 
00048     def _importNode(self, node):
00049         self._initProvider(node)
00050         self._logger.info('Browser layers imported')

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 62 of file exportimport.py.

00062 
00063     def _initLayers(self, node):
00064         for child in node.childNodes:
00065             if child.nodeName.lower() == 'layer':
00066                 name = child.getAttribute('name')
00067                 interface = _resolveDottedName(child.getAttribute('interface'))
00068                 register_layer(interface, name, site_manager=self.context)
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 51 of file exportimport.py.

00051 
00052     def _initProvider(self, node):
00053         if self.environ.shouldPurge():
00054             self._purgeLayers()
00055         self._initLayers(node)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file exportimport.py.

00056 
00057     def _purgeLayers(self):
00058         registeredLayers = [r.name for r in self.context.registeredUtilities() 
00059                             if r.provided == ILocalBrowserLayerType]
00060         for name in registeredLayers:
00061             unregister_layer(name, site_manager=self.context)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

string plone.browserlayer.exportimport.BrowserLayerXMLAdapter._LOGGER_ID = 'browserlayer' [static, private]

Definition at line 30 of file exportimport.py.

Definition at line 29 of file exportimport.py.


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