Back to index

plone3  3.1.7
Classes | Functions
plone.browserlayer.exportimport Namespace Reference

Classes

class  BrowserLayerXMLAdapter

Functions

def dummyGetId
def importLayers
def exportLayers

Function Documentation

Definition at line 20 of file exportimport.py.

00020 
00021 def dummyGetId():
00022     return ''

Export local browser layers

Definition at line 100 of file exportimport.py.

00100 
00101 def exportLayers(context):
00102     """Export local browser layers
00103     """
00104     sm = getSiteManager(context.getSite())
00105     if sm is None or not IComponentRegistry.providedBy(sm):
00106         logger = context.getLogger('browserlayer')
00107         logger.info("Can not register components - no site manager found.")
00108         return
00109 
00110     exporter = queryMultiAdapter((sm, context), IBody, name=u'plone.browserlayer')
00111     if exporter is not None:
00112         filename = '%s%s' % (exporter.name, exporter.suffix)
00113         body = exporter.body
00114         if body is not None:
            context.writeDataFile(filename, body, exporter.mime_type)
Import local browser layers

Definition at line 83 of file exportimport.py.

00083 
00084 def importLayers(context):
00085     """Import local browser layers
00086     """
00087     sm = getSiteManager(context.getSite())
00088     if sm is None or not IComponentRegistry.providedBy(sm):
00089         logger = context.getLogger('browserlayer')
00090         logger.info("Can not register components - no site manager found.")
00091         return
00092 
00093     importer = queryMultiAdapter((sm, context), IBody, name=u'plone.browserlayer')
00094     if importer is not None:
00095         filename = '%s%s' % (importer.name, importer.suffix)
00096         body = context.readDataFile(filename)
00097         if body is not None:
00098             importer.filename = filename # for error reporting
00099             importer.body = body