Ejemplo n.º 1
0
    def export_xml(self):
        """ Export
        """
        environ = SnapshotExportContext(self.context, 'utf-8')
        export = queryMultiAdapter((self.context, environ), IBody,
                                      name='metadata.progress.xml')

        return export.body
Ejemplo n.º 2
0
    def createSnapshot(self, snapshot_id):
        """ See ISetupTool.
        """
        context = SnapshotExportContext(self, snapshot_id)
        messages = {}
        steps = self.listExportSteps()

        for step_id in steps:

            handler = self.getExportStep(step_id)

            if handler is None:
                logger = logging.getLogger('GenericSetup')
                logger.error('Step %s has an invalid handler' % step_id)
                continue

            messages[step_id] = handler(context)

        return {'steps': steps,
                'messages': messages,
                'url': context.getSnapshotURL(),
                'snapshot': context.getSnapshotFolder()}
Ejemplo n.º 3
0
    def createSnapshot(self, snapshot_id):
        """ See ISetupTool.
        """
        context = SnapshotExportContext(self, snapshot_id)
        messages = {}
        steps = self.listExportSteps()

        for step_id in steps:

            handler = self.getExportStep(step_id)

            if handler is None:
                logger = logging.getLogger("GenericSetup")
                logger.error("Step %s has an invalid handler" % step_id)
                continue

            messages[step_id] = handler(context)

        return {
            "steps": steps,
            "messages": messages,
            "url": context.getSnapshotURL(),
            "snapshot": context.getSnapshotFolder(),
        }
Ejemplo n.º 4
0
 def export_xml(self, **kwargs):
     """ Export config as xml
     """
     environ = SnapshotExportContext(self.context, 'utf-8')
     exporter = queryMultiAdapter((self.context, environ), IBody)
     if not exporter:
         return self._redirect(
             'No adapter found',
             kwargs.get('redirect', 'configure_faceted.html'))
     self.request.response.setHeader('content-type',
                                     'text/xml; charset=utf-8')
     self.request.response.addHeader(
         "content-disposition",
         "attachment; filename=%s.xml" % (self.context.getId(), ))
     return exporter.body
 def _export_xml(self, **kwargs):
     """ Export
     """
     environ = SnapshotExportContext(self.context, 'utf-8')
     return queryMultiAdapter((self.context, environ), IBody)