Back to index

plone3  3.1.7
Classes | Functions
GenericSetup.components Namespace Reference

Classes

class  ComponentRegistryXMLAdapter

Functions

def importComponentRegistry
def exportComponentRegistry

Function Documentation

Export local components.

Definition at line 254 of file components.py.

00254 
00255 def exportComponentRegistry(context):
00256     """Export local components.
00257     """
00258     sm = getSiteManager(context.getSite())
00259     if sm is None or not IComponentRegistry.providedBy(sm):
00260         logger = context.getLogger('componentregistry')
00261         logger.debug("Nothing to export.")
00262         return
00263 
00264     exporter = queryMultiAdapter((sm, context), IBody)
00265     if exporter:
00266         body = exporter.body
00267         if body is not None:
00268             context.writeDataFile('componentregistry.xml', body,
00269                                   exporter.mime_type)
Import local components.

Definition at line 239 of file components.py.

00239 
00240 def importComponentRegistry(context):
00241     """Import local components.
00242     """
00243     sm = getSiteManager(context.getSite())
00244     if sm is None or not IComponentRegistry.providedBy(sm):
00245         logger = context.getLogger('componentregistry')
00246         logger.info("Can not register components, as no registry was found.")
00247         return
00248 
00249     importer = queryMultiAdapter((sm, context), IBody)
00250     if importer:
00251         body = context.readDataFile('componentregistry.xml')
00252         if body is not None:
00253             importer.body = body