Returns null if template is not found.
345729
public static StringTemplate getTemplateFrom(StringTemplateGroup group,
            String template)
    {
        try
        {
            return group.lookupTemplate(template);
        }
        catch (IllegalArgumentException e)
        {
            return null;
        }
    }
1086811
private Class<?> getTemplateClass() {
        String fqName = getTargetPackage() + "." + getName();
        try {
            mTemplateClass = getCompiler().loadClass(fqName);
        }
        catch (ClassNotFoundException nx) {
            try {
                mTemplateClass = getCompiler().loadClass(getName());  // Try standard path as a last resort
            }
            catch (ClassNotFoundException nx2) {
                return null;
            }
        }
        return mTemplateClass;
    }
114492
function(template, data){

    if (!template) {
      var error = new Error("Cannot render the template since it's false, null or undefined.");
      error.name = "TemplateNotFoundError";
      throw error;
    }

    var templateFunc;
    if (typeof template === "function"){
      templateFunc = template;
    } else {
      templateFunc = Marionette.TemplateCache.get(template);
    }

    return templateFunc(data);
  }
1113408
public T getTemplateFromCache(String filename) {

        LRUCache.CacheEntry<String, T> cachedTemplate = cache.get(filename);

        // this is to avoid null pointer exception in case of the layout composite template
        if (cachedTemplate == null) {
            return null;
        }

        return cachedTemplate.compiled;
    }
94628
def get_template(self, name):
        """"""
        filename = path.join(self.search_path, *[p for p in name.split('/')
                                                 if p and p[0] != '.'])
        if not path.exists(filename):
            raise TemplateNotFound(name)
        return Template.from_file(filename, self.encoding)
313139
public T locateLayoutTemplate(String controller, final String layout, final boolean useCache) throws ViewException {
        // first see if we have already looked for the template
        final String controllerLayoutCombined = controller + '/' + layout;
        if (useCache && cachedTemplates.containsKey(controllerLayoutCombined)) 
            return engine.clone(cachedTemplates.get(controllerLayoutCombined)); // README: computeIfAbsent does not save the result if null - which it actually might need to do to minimise disk reads
        
        
        T template;
        if ((template = lookupLayoutWithNonDefaultName(controllerLayoutCombined)) != null) 
            return cacheTemplate(controllerLayoutCombined, template, useCache);
        
        // going for defaults
        if ((template = lookupDefaultLayoutInControllerPathChain(controller)) != null) 
            return cacheTemplate(controllerLayoutCombined, template, useCache);
        
        if ((template = lookupDefaultLayout()) != null) 
            return cacheTemplate(controllerLayoutCombined, template, useCache);
        
        throw new ViewException(TemplateEngine.LAYOUT_DEFAULT + engine.getSuffixOfTemplatingEngine() + " is not to be found anywhere");
    }
793691
public Template getTemplate(String name, Object args) throws IOException, ParseException {
        if (args instanceof String)
            return getTemplate(name, (String) args);
        if (args instanceof Locale)
            return getTemplate(name, (Locale) args);
        return getTemplate(name, null, null, args);
    }
691061
def _find_template(self, template, tree, blocks, with_filename,
                   source, comment):
        
        from uliweb import application
        from uliweb.core.template import _format_code

        def get_rel_filename(filename, path):
            f1 = os.path.splitdrive(filename)[1]
            f2 = os.path.splitdrive(path)[1]
            f = os.path.relpath(f1, f2).replace('\\', '/')
            if f.startswith('..'):
                return filename.replace('\\', '/')
            else:
                return f

        template_file = None

        if not tree:
            application.template_loader.comment = comment
            files = application.template_loader.find_templates(template)
            if files:
                template_file = files[0]

                for x in files:
                    print x

                if source:
                    print
                    print '---------------- source of %s ---------------' % template
                    t = application.template_loader.load(template_file)
                    if t and comment:
                        print _format_code(t.code).rstrip()
                        print
                    else:
                        print t.code
                        print

            else:
                print 'Not Found'
        else:
            application.template_loader.print_tree(template)

        if template_file and blocks:
            application.template_loader.print_blocks(template, with_filename)
877641
@Nullable
	public Boolean isTemplated() {

		return Optional.ofNullable(this.url) //
				.map(s -> s.contains("{?") ? true : null) //
				.orElse(null);
	}
15534
def _TemplateExists(unused_value, context, args):
    """"""
    try:
        name = args[0]
    except IndexError:
        raise EvaluationError('The "template" predicate requires an argument.')
    return context.HasTemplate(name)
306533
def resolve_template(template):
    ""
    if isinstance(template, (list, tuple)):
        return loader.select_template(template)
    elif isinstance(template, basestring):
        try:
            return loader.get_template(template)
        except TemplateDoesNotExist:
            return None
    else:
        return template
1294156
def has_template(self, uri):
        
        try:
            self.get_template(uri)
            return True
        except exceptions.TemplateLookupException:
            return False
507114
public Response andTemplate(String template) {
        Objects.requireNonNull(template, Required.TEMPLATE.toString());
        this.template = template;

        return this;
    }
341957
def get_template(self, template_name):
        """"""
        try:
            return self.loader.load(template_name, encoding=self.encoding)
        except self.not_found_exception, e:
            # catch the exception raised by Genshi, convert it into a werkzeug
            # exception (for the sake of consistency)
            raise TemplateNotFound(template_name)
208618
def get_template_by_name(name,**kwargs):
    
    try:
        tmpl_i = db.DBSession.query(Template).filter(Template.name == name).options(joinedload_all('templatetypes.typeattrs.default_dataset.metadata')).one()
        return tmpl_i
    except NoResultFound:
        log.info("%s is not a valid identifier for a template",name)
        raise HydraError('Template "%s" not found'%name)
864999
private String resolveTemplate(AnnotationValue<Client> clientAnnotation, String templateString) {
        String path = clientAnnotation.get("path", String.class).orElse(null);
        if (StringUtils.isNotEmpty(path)) {
            return path + templateString;
        } else {
            String value = clientAnnotation.getValue(String.class).orElse(null);
            if (StringUtils.isNotEmpty(value)) {
                if (value.startsWith("/")) {
                    return value + templateString;
                }
            }
            return templateString;
        }
    }
58404
private Template getTemplate(String templateName) throws ParseException {
    try {
      return config.getTemplate(templateName, "UTF-8");
    } catch (ParseException e) {
      throw e;
    } catch (IOException e) {
      logger.error("Couldn't load template '{}',loader is {}", templateName,
          config.getTemplateLoader().getClass());
      throw Throwables.propagate(e);
    }
  }