Exports the media folder on the server.

    Usage::

        fab prod run_export_media
        fab prod run_export_media:filename=foobar.tar.gz
343185
def run_export_media(filename=None):
    
    if not filename:
        filename = settings.MEDIA_DUMP_FILENAME

    with cd(settings.FAB_SETTING('SERVER_MEDIA_ROOT')):
        run('rm -rf {0}'.format(filename))
        run('tar -czf {0} *'.format(filename))
        run('mv {0} {1}'.format(
            filename, settings.FAB_SETTING('SERVER_MEDIA_BACKUP_DIR')))
458369
def export(self, contentType):
        
        cls = munge.get_codec(contentType)
        codec = cls()
        return codec.dumps(self.__dict__())
1327473
def export_data(filename_or_fobj, data, mode="w"):
    """"""

    if filename_or_fobj is None:
        return data

    _, fobj = get_filename_and_fobj(filename_or_fobj, mode=mode)
    source = Source.from_file(filename_or_fobj, mode=mode, plugin_name=None)
    source.fobj.write(data)
    source.fobj.flush()
    return source.fobj
399898
def export(args={})
      raise ":filename not provided" unless args.key?(:filename)

      filename = args[:filename]
      logger   = options.fetch(:logger, Rails.logger)

      File.delete(filename) if File.exists?(filename)

      logger.debug{ "Creating a new Zip file in #{filename}..." }

      Zip::File.open(filename, Zip::File::CREATE) do |zipfile|
        @project.nodes.each do |node|
          node_path = Attachment.pwd.join(node.id.to_s)

          Dir["#{node_path}/**/**"].each do |file|
            logger.debug{ "\tAdding attachment for '#{node.label}': #{file}" }
            zipfile.add(file.sub("#{Attachment.pwd.to_s}/", ''), file)
          end
        end

        logger.debug{ "\tAdding XML repository dump" }

        exporter_class    = Rails.application.config.dradis.projects.template_exporter
        template_exporter = exporter_class.new(options)
        template          = template_exporter.export

        zipfile.get_output_stream('dradis-repository.xml') { |out|
          out << template
        }
      end

      logger.debug{ 'Done.' }
    end
341227
def export_pdf(self, filename):
        
        self.make_request(
            raw_result=True,
            resource='export',
            filename=filename, 
            headers = {'accept': 'application/pdf'})
219217
def fast_sync_snapshot_compress( snapshot_dir, export_path ):
    

    snapshot_dir = os.path.abspath(snapshot_dir)
    export_path = os.path.abspath(export_path)
    if os.path.exists(export_path):
        return {'error': 'Snapshot path exists: {}'.format(export_path)}

    old_dir = os.getcwd()
    
    count_ref = [0]

    def print_progress(tarinfo):
        count_ref[0] += 1
        if count_ref[0] % 100 == 0:
            log.debug("{} files compressed...".format(count_ref[0]))

        return tarinfo

    try:
        os.chdir(snapshot_dir)
        with tarfile.TarFile.bz2open(export_path, "w") as f:
            f.add(".", filter=print_progress)

    except:
        os.chdir(old_dir)
        raise
    
    finally:
        os.chdir(old_dir)

    return {'status': True}
504523
def image_export(cls, source_path, dest_url, **kwargs):
        
        dest_path = urlparse.urlparse(dest_url).path
        if kwargs['remote_host']:
            target_path = ':'.join([kwargs['remote_host'], dest_path])
            command = ' '.join(['/usr/bin/scp',
                                "-P", CONF.zvm.remotehost_sshd_port,
                                "-o StrictHostKeyChecking=no",
                                '-r ', source_path, target_path])
            (rc, output) = zvmutils.execute(command)
            if rc:
                msg = ("Error happened when copying image file to remote "
                       "host with reason: %s" % output)
                LOG.error(msg)
                raise exception.SDKImageOperationError(rs=21, msg=output)
        else:
            # Copy to local file system
            LOG.debug("Remote_host not specified, will copy to local server")
            try:
                shutil.copyfile(source_path, dest_path)
            except Exception as err:
                msg = ("Export image from %(src)s to local file system"
                       " %(dest)s failed: %(err)s" %
                       {'src': source_path,
                        'dest': dest_path,
                        'err': six.text_type(err)})
                LOG.error(msg)
                raise exception.SDKImageOperationError(rs=22,
                                                       err=six.text_type(err))
178298
def export_to_file(self, filename):
        
        instr_json = self.export_struct()

        with open(filename, 'w') as fp:
            json.dump(instr_json, fp, indent=2)
36227
public function exportArchiveAction()
    {
        $params = $this->_processParameters($this->showParameters);

        $this->addSnippets($this->exportSnippets, $params);

        $this->html->h2($this->_('Export respondent archive'));

        //Now show the export form
        $export = $this->loader->getRespondentExport();
        $form   = $export->getForm();
        $div    = $this->html->div(array('id' => 'mainform'));
        $div[]  = $form;

        $request = $this->getRequest();

        $form->populate($request->getParams());

        if ($request->isPost()) {
            $respondent = $this->getRespondent();
            $patients   = array(
                array(
                    'gr2o_id_organization' => $respondent->getOrganizationId(),
                    'gr2o_patient_nr'      => $respondent->getPatientNumber()
                    )
                );
            $export->render($patients, $request->getParam('group'), $request->getParam('format'));
        }
    }
1093647
def export(self, location):
        
        # Remove the location to make sure Bazaar can export it correctly
        if os.path.exists(location):
            rmtree(location)

        with TempDirectory(kind="export") as temp_dir:
            self.unpack(temp_dir.path)

            self.run_command(
                ['export', location],
                cwd=temp_dir.path, show_stdout=False,
            )
193173
def export(self, filename, fmt="DER"):
        
        f = open(filename, "wb")
        if fmt == "DER":
            f.write(self.der)
        elif fmt == "PEM":
            f.write(self.pem)
        f.close()
1048123
def _to_tarfile(self, file_generator):
        
        if file_generator.to_path_compression == "tar":
            tar_mode = "w"
        elif file_generator.to_path_compression == "tar.gz":
            tar_mode = "w:gz"
        elif file_generator.to_path_compression == 'tar.bz2':
            tar_mode = "w:bz2"
        else:
            tar_mode = "w"

        with tarfile.open(file_generator.to_path, mode=tar_mode) as outfile:
            for f in file_generator:
                outpath = self._output_path(f.source, file_generator.to_format, archive=True)
                info = tarfile.TarInfo(outpath)
                data = f.writestr(file_generator.to_format).encode()
                info.size = len(data)
                outfile.addfile(tarinfo=info, fileobj=io.BytesIO(data))
394685
def model_export(model, file_name, repo=None):
    
    with codecs.open(file_name, 'w', encoding="utf-8") as f:
        model_export_to_file(f, model, repo)
408938
def export(self, location):
        """"""
        temp_dir = tempfile.mkdtemp('-export', 'pip-')
        self.unpack(temp_dir)
        if os.path.exists(location):
            # Remove the location to make sure Bazaar can export it correctly
            rmtree(location)
        try:
            call_subprocess([self.cmd, 'export', location], cwd=temp_dir,
                            filter_stdout=self._filter, show_stdout=False)
        finally:
            rmtree(temp_dir)
259732
def export(self):
        
        if self._with_threads:
            utils.invoke_different_funcs_in_parallel(
                *map(lambda mgr: mgr.export, self._get_export_mgr())
            )
        else:
            for mgr in self._get_export_mgr():
                mgr.export()

        return self.exported_disks_paths()
166080
def export(self, swf, frame, **export_opts):
        
        self.wanted_frame = frame
        return super(FrameSVGExporterMixin, self).export(swf, *export_opts)
1142585
def exportProfile(self, filename=''):
        
        if not (filename and isinstance(filename, basestring)):
            filename = QtGui.QFileDialog.getSaveFileName(self,
                                                         'Export Layout as...',
                                                         QtCore.QDir.currentPath(),
                                                         'XView (*.xview)')
            
            if type(filename) == tuple:
                filename = filename[0]
        
        filename = nativestring(filename)
        if not filename:
            return
        
        if not filename.endswith('.xview'):
            filename += '.xview'
        
        profile = self.saveProfile()
        profile.save(filename)