Retrieve all templates.

    Argument:

        server:   TonicDNS API server
        token:    TonicDNS API authentication token

    x-authentication-token: token
189833
def get_all_templates(server, token):
    
    method = 'GET'
    uri = 'https://' + server + '/template'
    connect.tonicdns_client(uri, method, token, data=False)
921856
def index_template_get(name, hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        return es.indices.get_template(name=name)
    except elasticsearch.exceptions.NotFoundError:
        return None
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot retrieve template {0}, server returned code {1} with message {2}".format(name, e.status_code, e.error))
333772
def get_template_names(self):
        '''
        
        '''

        # Get user template
        template_model = getattr(self, 'template_model', "{0}/{1}_{2}".format(self._appname.lower(), self._modelname.lower(), self.get_template_names_key))
        template_model_ext = getattr(self, 'template_model_ext', 'html')
        templates = get_template(template_model, self.user, self.language, template_model_ext, raise_error=False)
        if type(templates) == list:
            templates.append("codenerix/{0}.html".format(self.get_template_names_key))

        # Return thet of templates
        return templates
770274
def get_template_data(self, request, *args, **kwargs):
        ''''''

        # little tricky with vertical centering
        dimension = int(self.get_size().split('x')[0])

        data = {}

        if dimension <= 356:
            data['image_dimension'] = "row-md-13"

        if self.get_template_name().name.split("/")[-1] == "directories.html":
            data['directories'] = self.get_directories(request)

        return data
544902
def _get_template_texts(source_list=None,
                        template='jinja',
                        defaults=None,
                        context=None,
                        **kwargs):
    '''
    
    '''

    ret = {'name': '_get_template_texts',
           'changes': {},
           'result': True,
           'comment': '',
           'data': []}

    if source_list is None:
        return _error(ret,
                      '_get_template_texts called with empty source_list')

    txtl = []

    for (source, source_hash) in source_list:

        context_dict = defaults if defaults else {}
        if context:
            context_dict = salt.utils.dictupdate.merge(context_dict, context)
        rndrd_templ_fn = __salt__['cp.get_template'](
            source,
            '',
            template=template,
            saltenv=__env__,
            context=context_dict,
            **kwargs
        )
        log.debug('cp.get_template returned %s (Called with: %s)',
                  rndrd_templ_fn, source)
        if rndrd_templ_fn:
            tmplines = None
            with salt.utils.files.fopen(rndrd_templ_fn, 'rb') as fp_:
                tmplines = fp_.read()
                tmplines = salt.utils.stringutils.to_unicode(tmplines)
                tmplines = tmplines.splitlines(True)
            if not tmplines:
                msg = 'Failed to read rendered template file {0} ({1})'.format(
                    rndrd_templ_fn, source
                )
                log.debug(msg)
                ret['name'] = source
                return _error(ret, msg)
            txtl.append(''.join(tmplines))
        else:
            msg = 'Failed to load template file {0}'.format(source)
            log.debug(msg)
            ret['name'] = source
            return _error(ret, msg)

    ret['data'] = txtl
    return ret
713736
def get_template(self, template_id):
        ''' 

        '''
        request = self._get_request()
        return request.get(self.TEMPLATE_GET_URL + template_id)
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)
782579
def get_template_names(self):
        
        if self.request.is_ajax():
            return [self.list_template_name]
        else:
            return super(UserMaps, self).get_template_names()
752389
def get_template_sources(template_name, template_dirs=None):
        
        if not connection.tenant or isinstance(connection.tenant, FakeTenant):
            return
        if not template_dirs:
            try:
                template_dirs = settings.MULTITENANT_TEMPLATE_DIRS
            except AttributeError:
                raise ImproperlyConfigured('To use %s.%s you must define the MULTITENANT_TEMPLATE_DIRS' %
                                           (__name__, FilesystemLoader.__name__))
        for template_dir in template_dirs:
            try:
                if '%s' in template_dir:
                    yield safe_join(template_dir % connection.tenant.domain_url, template_name)
                else:
                    yield safe_join(template_dir, connection.tenant.domain_url, template_name)
            except UnicodeDecodeError:
                # The template dir name was a bytestring that wasn't valid UTF-8.
                raise
            except ValueError:
                # The joined path was located outside of this particular
                # template_dir (it might be inside another one, so this isn't
                # fatal).
                pass
1225271
def list_instance_templates(self):
        
        response = self.get_proto(path='/instance-templates')
        message = rest_pb2.ListInstanceTemplatesResponse()
        message.ParseFromString(response.content)
        templates = getattr(message, 'template')
        return iter([InstanceTemplate(template) for template in templates])
1163627
def get_template(name, zone_name=nil)

      # TODO: use name parameter
      # listTemplates in CloudStack 2.2 doesn't seem to work
      # when the name parameter is specified. When this is fixed,
      # the name parameter should be added to the request.

      zone = zone_name ? get_zone(zone_name) : get_default_zone

      params = {
          'command' => 'listTemplates',
          'templateFilter' => 'executable',
      }
      params['zoneid'] = zone['id'] if zone

      json = send_request(params)

      templates = json['template']
      return nil unless templates

      templates.each { |t|
        if name.is_uuid? then
          return t if t['id'] == name
        else
          return t if t['name'] == name
        end
      }
      nil
    end
94631
def get_all_host_templates(resource_root, cluster_name="default"):
  
  return call(resource_root.get,
      HOST_TEMPLATES_PATH % (cluster_name,),
      ApiHostTemplate, True, api_version=3)
618353
def get_template_names(self):
        
        names = super(CRUDMixin, self).get_template_names()
        if self.crud_template_name:
            names.append(self.crud_template_name)
        return names
1320285
def templates_for_device(request, templates):
    
    from yacms.conf import settings
    if not isinstance(templates, (list, tuple)):
        templates = [templates]
    device = device_from_request(request)
    device_templates = []
    for template in templates:
        if device:
            device_templates.append("%s/%s" % (device, template))
        if settings.DEVICE_DEFAULT and settings.DEVICE_DEFAULT != device:
            default = "%s/%s" % (settings.DEVICE_DEFAULT, template)
            device_templates.append(default)
        device_templates.append(template)
    return device_templates
824742
function getTemplates(config) {

  var templates = {};

  Object.keys(templatePaths).forEach(function(key) {
      if (config.templates && (config.templates[key] && config.templates[key] !== true)) {
        templates[key] = config.templates[key];
      } else {
        templates[key] = fs.readFileSync(__dirname + templatePaths[key], "utf-8");
      }
    });

  return templates;
}
1004458
def get_template_names(self):
        """"""
        if self.request.is_ajax():
            template = self.ajax_template_name
        else:
            template = self.template_name
        return template
1331009
def get_placeholders(template_name):
    
    try:
        temp = loader.get_template(template_name)
    except TemplateDoesNotExist:
        return []

    plist, blist = [], []
    try:
        # django 1.8
        _placeholders_recursif(temp.template.nodelist, plist, blist)
    except AttributeError:
        # django 1.7
        # raise
        _placeholders_recursif(temp.nodelist, plist, blist)
    return plist