Render a typical File Field.
166215
def render_filefield(field, attrs):
	
	field.field.widget.attrs["style"] = "display:none"

	if not "_no_label" in attrs:
		attrs["_no_label"] = True

	return wrappers.FILE_WRAPPER % {
		"field": field,
		"id": "id_" + field.name,
		"style": pad(attrs.get("_style", "")),
		"text": escape(attrs.get("_text", "Select File")),
		"icon": format_html(wrappers.ICON_TEMPLATE, attrs.get("_icon", "file outline"))
	}
283342
def render(self, template, filename, context={}, filters={}):
        
        filename = os.path.normpath(filename)
        path, file = os.path.split(filename)
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise

        path, file = os.path.split(template)
        loader = jinja2.FileSystemLoader(path)
        env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
        env.filters.update(filters)
        template = env.get_template(file)
        text = template.render(context)
        with open(filename, 'wt') as f:
            f.write(text)
1322796
def render(self):
        """"""
        return FRAME_HTML % {
            'id': self.id,
            'filename': escape(self.filename),
            'lineno': self.lineno,
            'function_name': escape(self.function_name),
            'current_line': escape(self.current_line.strip())
        }
601126
def render_file(self, filename):
        
        dirname, basename = split(filename)
        with changedir(dirname):
            infile = abspath(basename)
            outfile = abspath('.%s.html' % basename)
            self.docutils.publish_file(infile, outfile, self.styles)
            return outfile
1061327
function renderSync(filename, options) {
  var template = getTemplate(filename, options);
  return template.render({ model: options, });
}
543639
def render(self):
        '''
        
        '''
        data = self.prepare_data()
        if self.field.readable:
            return self.env.template.render(self.template, **data)
        return ''
854188
public void render(Map<?, ?> data, File file) {
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(file);
			render(data, fos);
		} catch (FileNotFoundException e) {
			throw new RuntimeException(e);
		} finally {
			if (fos != null) {
				try {fos.close();} catch (IOException e) {e.printStackTrace(System.err);}
			}
		}
	}
993776
function render(filename, options, callback) {
  var isAsync = callback && typeof callback === 'function';

  if (!isAsync) {
    return renderSync(filename, options)
  }

  getTemplate(filename, options, function(err, template) {
    if (err) {
      return callback(err);
    }

    template.render({ model: options, }, callback);
  });
}
52699
def render_string(self, path: str, **kwargs: Any) -> bytes:
        """"""
        return self.handler.render_string(path, **kwargs)
1086
function render(options, report, cb) {
  var reportName = options.outputReportName || 'report.json';
  var files = {};
  files[reportName] = report;
  var renderFunctions = u.toArray(options.render || 'default');
  try {
    renderFunctions = u.findFunctions(renderFunctions, 'render');
  } catch (findError) {
    return cb(findError);
  }
  function eachRender(fn, cb) {
    fn(options, files, function (err, renderedFiles) {
      if (err) {
        return cb(err);
      }
      files = renderedFiles;
      cb(null, files);
    });
  }
  async.forEachSeries(renderFunctions, eachRender, function (err) {
    // if (err) {
    //   return cb(err);
    // }
    // Object.keys(files).forEach(function (filename, i) {
    //   var file = files[filename];
    //   if (typeof file !== 'string') {
    //     try {
    //       // if circular references were introduced, this will fail
    //       var fileString = JSON.stringify(file, null, 2);
    //       files[filename] = fileString;
    //     } catch (jsonError) {
    //       return cb(jsonError);
    //     }
    //   }
    // });
    cb(err, files);
  });
}
1022147
def file_view(self, request, field_entry_id):
        
        model = self.fieldentry_model
        field_entry = get_object_or_404(model, id=field_entry_id)
        path = join(fs.location, field_entry.value)
        response = HttpResponse(content_type=guess_type(path)[0])
        f = open(path, "r+b")
        response["Content-Disposition"] = "attachment; filename=%s" % f.name
        response.write(f.read())
        f.close()
        return response
237943
function render_file($item)
    {
        if ($item['name'] === '')
        {
            Eresus_Kernel::app()->getPage()->addErrorMessage(
                sprintf(errFormFieldHasNoName, $item['type'], $this->form['name']));
        }
        $result = "\t\t".'<tr><td class="formLabel">'.$item['label']."</td><td><input type=\"file\" name=\"".$item['name']."\"".(isset($item['width']) ? ' size="'.$item['width'].'"':'').$this->attrs($item)." />".$item['comment']."</td></tr>\n";
        $this->file = true;
        return $result;
    }
295900
protected function render()
	{
		if (empty($this->getContent())) {
			$parsed = YamlRender::parse($this->file->getContent());
			$this->setContent(is_array($parsed) ? $parsed : []);
		}
	}
942241
def files_view(request):
    """"""

    hosts = Host.objects.visible_to_user(request.user)

    context = {"hosts": hosts}
    return render(request, "files/home.html", context)
1256182
def render_field(field):
    
    field = field.field if isinstance(field, forms.BoundField) else field
    validators = {}

    def no_compare_validator():
        return not ('lessThan' in validators or 'greaterThan' in validators or 'between' in validators)

    if field.required:
        validators['notEmpty'] = {}
    validator_codes = [item.code for item in field.validators]
    for v in field.validators:
        if isinstance(v, MinLengthValidator):
            vc = validators.get('stringLength', {})
            vc['min'] = field.min_length
            validators.update({'stringLength': vc})
        elif isinstance(v, MaxLengthValidator):
            vc = validators.get('stringLength', {})
            vc['max'] = field.max_length
            validators.update({'stringLength': vc})
        elif isinstance(v, (MinValueValidator, MaxValueValidator)):
            if 'min_value' in validator_codes and 'max_value' in validator_codes:
                vc = validators.get('between', {})
                if v.code == 'min_value':
                    vc['min'] = field.min_value
                else:
                    vc['max'] = field.max_value
                validators.update({'between': vc})
            elif v.code == 'min_value':
                validators['greaterThan'] = {'value': field.min_value}
            elif v.code == 'max_value':
                validators['lessThan'] = {'value': field.max_value}
        elif isinstance(v, BaseBV):
            validators.update(v.get_validator_code())

    if isinstance(field, (fields.DecimalField, fields.FloatField)) and no_compare_validator():
        validators['numeric'] = {}
    elif isinstance(field, fields.IntegerField) and no_compare_validator():
        validators['integer'] = {}
    elif isinstance(field, (fields.DateField, fields.DateTimeField)):
        formats = field.input_formats
        if formats:
            validators['date'] = {'format': convert_datetime_python_to_javascript(formats[0])}
    elif isinstance(field, fields.TimeField):
        validators['regexp'] = {'regexp': '^((([0-1]?[0-9])|([2][0-3])):)(([0-5][0-9]):)([0-5][0-9])$',
        }
    elif isinstance(field, fields.URLField):
        validators['uri'] = {}
    elif isinstance(field, fields.EmailField):
        validators['emailAddress'] = {}
    elif isinstance(field, fields.ImageField):
        if 'file' not in validators:
            validators.update(ImageFileValidator().get_validator_code())
    return {'validators': validators}
600095
def render_files(self, root=None):
        
        if root is None:
            tmp =  os.environ.get('TMP')
            root = sys.path[1 if tmp and tmp in sys.path else 0]
        items = []
        for filename in os.listdir(root):
            # for subdirname in dirnames:
            #     path = os.path.join(dirname, subdirname)
            #     items.append(FOLDER_TMPL.format(
            #         name=subdirname,
            #         id=path,
            #         items=self.render_files(path)
            #     ))
            #for filename in filenames:
            f,ext = os.path.splitext(filename)
            if ext in ['.py', '.enaml']:
                items.append(FILE_TMPL.format(
                    name=filename,
                    id=filename
                ))

        return "".join(items)
879123
function renderTemplateFile(engine, filePath, context) {
    var loader = engine.getLoader();

    // Resolve the filePath
    var resolvedFilePath = loader.resolve(null, filePath);

    return Promise()
    .then(function() {
        if (!loader.async) {
            return loader.getSource(resolvedFilePath);
        }

        var deferred = Promise.defer();
        loader.getSource(resolvedFilePath, deferred.makeNodeResolver());
        return deferred.promise;
    })
    .then(function(result) {
        if (!result) {
            throw error.TemplateError(new Error('Not found'), {
                filename: filePath
            });
        }

        return render(engine, result.path, result.src, context);
    });

}