Return the Template data for this AR
331795
def get_template_data_for(self, ar):
        
        info = None
        template = ar.getTemplate()
        ar_sampletype_uid = api.get_uid(ar.getSampleType())
        ar_container_uid = ""
        if ar.getContainer():
            ar_container_uid = api.get_uid(ar.getContainer())
        ar_preservation_uid = ""
        if ar.getPreservation():
            ar_preservation_uid = api.get_uid(ar.getPreservation())

        if template:
            info = self.get_base_info(template)

            analyses = template.getAnalyses()
            partition_analyses = map(
                lambda x: (x.get("partition"), x.get("service_uid")), analyses)

            analyses_by_partition = defaultdict(list)
            for partition, service_uid in partition_analyses:
                analyses_by_partition[partition].append(service_uid)

            sampletypes_by_partition = defaultdict(list)
            containers_by_partition = defaultdict(list)
            preservations_by_partition = defaultdict(list)
            for part in template.getPartitions():
                part_id = part.get("part_id")
                sampletype_uid = part.get('sampletype_uid', ar_sampletype_uid)
                sampletypes_by_partition[part_id] = sampletype_uid
                container_uid = part.get("container_uid", ar_container_uid)
                containers_by_partition[part_id] = container_uid
                preserv_uid = part.get("preservation_uid", ar_preservation_uid)
                preservations_by_partition[part_id] = preserv_uid

            partitions = map(lambda p: p.get("part_id"),
                             template.getPartitions())
            info.update({
                "analyses": analyses_by_partition,
                "partitions": partitions,
                "sample_types": sampletypes_by_partition,
                "containers": containers_by_partition,
                "preservations": preservations_by_partition,
            })
        else:
            info = {
                "analyses": {},
                "partitions": [],
                "sample_types": {},
                "containers": {},
                "preservations": {},
            }
        return info
1082526
function() {
            var self = this;

            this.template = this.options.template;
            this.args = this.options.args || {};

            // Related view
            this.view = this.options.view || null;

            // Init template context
            _.extend(this.args, {
                "_": _,
                "hr": {
                    "configs": configs,
                    "urls": Urls,
                    "i18n": I18n,
                    "offline": Offline
                },
                "view": {
                    "component": function(cid, args, name, subid) {
                        name = name || cid;

                        if (!self.view) {
                            throw new Error("Error in template " + self.template + " : try to import component in a non view-related template ");
                        }

                        if (Template.components[cid] == null) {
                            throw new Error("Error in template " + self.template + " : try to import component "+cid);
                        }

                        var view = new Template.components[cid].Class(args || {}, self.view);
                        
                        self.view.addComponent(name, view);

                        var component = $("<component/>", {
                            "data-component": view.cid
                        });

                        return component[0].outerHTML;
                    }
                },
                "template": {
                    "args": this.args,
                    "name": this.template,
                    "import": function(name, args, cname) {
                        cname = cname || name;
                        return this.args.view.component("template", {template: name, args: args}, cname);
                    },
                    "htmlid": function(h) {
                        return _.escape(h);
                    }
                }
            }, Template.options);

            return this;
        }
50318
def template(name, datas)
      file = template_path(name)
      content = File.read(file)

      datas.each do |k, v|
        k = "<%= #{k} %>"
        content = content.gsub(k, v)
      end
      return content
    end
171668
def get_template(self, data=None):  # noqa (complexity)
        """"""
        with self.__lock:
            if self.__value_templates is None and self.__last_parse_ok:
                try:
                    self.__refresh()
                except RefreshException:
                    # Point has no (useable) values - don't try to refetch again
                    self.__last_parse_ok = False
                    raise
            if self.__value_templates is None:
                raise ValueError('Point has no values')
            if data is None:
                template = PointDataObject(self.__value_templates, self.__filter)
            else:
                while True:
                    try:
                        template = PointDataObject._from_dict(self.__value_templates, self.__filter, data)
                    except:
                        # parsing has failed for first time since refresh so try again
                        if self.__last_parse_ok:
                            logger.debug('Failed to parse data from for point %s, refreshing', self.__point)
                            self.__last_parse_ok = False
                            try:
                                self.__refresh()
                            except RefreshException:
                                break
                        else:
                            raise
                    else:
                        self.__last_parse_ok = True
                        break
            return template
1176791
function template(tmpl, data) {
  // Grab the template engine
  var engine = settings['template engine'];

  // Process the template through the template engine
  var content = engine.call(this, tmpl, data);

  // Return the content
  return content;
}
543639
def render(self):
        '''
        
        '''
        data = self.prepare_data()
        if self.field.readable:
            return self.env.template.render(self.template, **data)
        return ''
107579
def get_template_names(self):
        
        if self.request.is_ajax():
            return [self.list_template_name]
        else:
            return super(Search, self).get_template_names()
1004458
def get_template_names(self):
        """"""
        if self.request.is_ajax():
            template = self.ajax_template_name
        else:
            template = self.template_name
        return template
858538
def get_template(request, query, meta, proxyMode):
    """"""

    templateContent = None

    if not proxyMode:

        templateContent = plugIt.getTemplate(query, meta)

        if not templateContent:
            return (None, gen404(request, baseURI, 'template'))

    return (templateContent, None)
534902
def get_template(name):
    
    path = pkg_resources.resource_filename('vr.runners', 'templates/' + name)
    with open(path, 'r') as f:
        return f.read()
817534
def render_to_string(self, template, context=None, def_name=None, subdir='templates'):
        ''''''
        template_adapter = self.get_template_loader(subdir).get_template(template)
        return getattr(template_adapter, 'render')(context=context, request=self.request, def_name=def_name)
144007
def get_template(self, tname):
        

        if self.custom_templates and self.custom_templates.get(tname, None):
            return self.custom_templates.get(tname)
        elif self.inlineformset:
            return 'crudbuilder/inline/{}.html'.format(tname)
        else:
            return 'crudbuilder/instance/{}.html'.format(tname)
1285043
def _get_template(self):
        
        loader = PackageLoader(self._package_name, 'assets/templates')
        env = Environment(extensions=['jinja2.ext.with_'], loader=loader)
        return env.get_template('{}.html'.format(self._report_name))
1053081
def cls(self):
        
        # TODO: register the resulting type?
        return SmartTemplate(self.name)(", ".join(map(str, self.params)))
964235
def rendered(self):
        """"""
        if not self._rendered:
            template_path = get_template_path(self.raw_template_path)
            if template_path:
                with open(template_path, 'r') as template:
                    if len(os.path.splitext(template_path)) == 2 and (
                            os.path.splitext(template_path)[1] == '.j2'):
                        self._rendered = Template(template.read()).render(
                            context=self.context,
                            mappings=self.mappings,
                            name=self.name,
                            variables=self.resolved_variables
                        )
                    else:
                        self._rendered = template.read()
            else:
                raise InvalidConfig(
                    'Could not find template %s' % self.raw_template_path
                )

        return self._rendered
773990
def _get_template(self, template_name):
        
        if template_name not in self.chached_templates:
            self.chached_templates[template_name] = self.env.get_template(template_name)
        return self.chached_templates[template_name]
370198
def get_templates(self, id_or_uri, start=0, count=-1, filter='', query='', sort=''):
        
        uri = self._client.build_uri(id_or_uri) + "/templates"
        return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter,
                                                             query=query, sort=sort, uri=uri))