Back to index

plone3  3.1.7
Classes | Functions
ResourceRegistries.exportimport.resourceregistry Namespace Reference

Classes

class  ResourceRegistryNodeAdapter

Functions

def importResRegistry
def exportResRegistry

Function Documentation

def ResourceRegistries.exportimport.resourceregistry.exportResRegistry (   context,
  reg_id,
  reg_title,
  filename 
)
Export resource registry.

Definition at line 32 of file resourceregistry.py.

00032 
00033 def exportResRegistry(context, reg_id, reg_title, filename):
00034     """
00035     Export resource registry.
00036     """
00037     site = context.getSite()
00038     logger = context.getLogger('resourceregistry')
00039     res_reg = getToolByName(site, reg_id, None)
00040     if res_reg is None:
00041         logger.info("%s: Nothing to export." % reg_title)
00042         return
00043 
00044     exporter = zapi.queryMultiAdapter((res_reg, context), IBody)
00045     if exporter is None:
00046         logger.warning("%s: Export adapter missing." % reg_title)
00047         return
00048 
00049     context.writeDataFile(filename, exporter.body, exporter.mime_type)
00050     logger.info("%s exported" % reg_title)
00051 

Here is the call graph for this function:

Here is the caller graph for this function:

def ResourceRegistries.exportimport.resourceregistry.importResRegistry (   context,
  reg_id,
  reg_title,
  filename 
)
Import resource registry.

Definition at line 10 of file resourceregistry.py.

00010 
00011 def importResRegistry(context, reg_id, reg_title, filename):
00012     """
00013     Import resource registry.
00014     """
00015     site = context.getSite()
00016     logger = context.getLogger('resourceregistry')
00017 
00018     body = context.readDataFile(filename)
00019     if body is None:
00020         logger.info("%s: Nothing to import" % reg_title)
00021         return
00022 
00023     res_reg = getToolByName(site, reg_id)
00024 
00025     importer = zapi.queryMultiAdapter((res_reg, context), IBody)
00026     if importer is None:
00027         logger.warning("%s: Import adapter missing." % reg_title)
00028         return
00029 
00030     importer.body = body
00031     logger.info("%s imported." % reg_title)

Here is the call graph for this function:

Here is the caller graph for this function: