Build the list of templates related to this user
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
335138
function generateTaskList (user) {
		
		var text = '';
		
		for (var t = 0; t < user.tasks.length; t++) {
			text = text + '> `' + (t + 1) + '`) ' + user.tasks[t] + '\n';
		}
		
		return text;
		
	}
852778
def save_user_template(self, user, fingers=[]):
        
        if not isinstance(user, User):
            users = self.get_users()
            tusers = list(filter(lambda x: x.uid==user, users))
            if len(tusers) == 1:
                user = tusers[0]
            else:
                tusers = list(filter(lambda x: x.user_id==str(user), users))
                if len(tusers) == 1:
                    user = tusers[0]
                else:
                    raise ZKErrorResponse("Can't find user")
        if isinstance(fingers, Finger):
            fingers = [fingers]
        fpack = b""
        table = b""
        fnum = 0x10
        tstart = 0
        for finger in fingers:
            tfp = finger.repack_only()
            table += pack("<bHbI", 2, user.uid, fnum + finger.fid, tstart)
            tstart += len(tfp)
            fpack += tfp
        if self.user_packet_size == 28:
            upack = user.repack29()
        else:
            upack = user.repack73()
        head = pack("III", len(upack), len(table), len(fpack))
        packet = head + upack + table + fpack
        self._send_with_buffer(packet)
        command = 110
        command_string = pack('<IHH', 12,0,8)
        cmd_response = self.__send_command(command, command_string)
        if not cmd_response.get('status'):
            raise ZKErrorResponse("Can't save utemp")
        self.refresh_data()
251254
def run_list():
    
    term = TerminalView()
    term.print_info("These are the available templates:")
    import pkgutil, projy.templates
    pkgpath = os.path.dirname(projy.templates.__file__)
    templates = [name for _, name, _ in pkgutil.iter_modules([pkgpath])]
    for name in templates:
        # the father of all templates, not a real usable one
        if (name != 'ProjyTemplate'):
            term.print_info(term.text_in_color(template_name_from_class_name(name), TERM_PINK))
550760
def list_templates():
    """"""
    templates = [f for f in glob.glob(os.path.join(template_path, '*.yaml'))]
    return templates
179179
private String buildTemplates() {
		String[] templateString = new String[model.getTemplates().size()];
		for (int i = 0; i < (model.getTemplates().size()); i++) {
			String templateLoaded = loadTemplateFile(
					model.getTemplates().get(i));
			if (templateLoaded != null) {
				templateString[i] = templateLoaded;
			}
		}
		return implode(templateString, File.pathSeparator);
	}
1117946
def _build_new_template(self, stack, parameters):
        
        log_lines = ["New template parameters:"]
        for param in sorted(parameters,
                            key=lambda param: param['ParameterKey']):
            log_lines.append("%s = %s" % (param['ParameterKey'],
                                          param['ParameterValue']))

        log_lines.append("\nNew template contents:")
        log_lines.append("".join(stack))
        return log_lines
243819
def put(self, template_name):
        """"""
        self.reqparse.add_argument('template', type=str, required=True)
        args = self.reqparse.parse_args()

        template = db.Template.find_one(template_name=template_name)

        if not template:
            return self.make_response('No such template found', HTTP.NOT_FOUND)

        changes = diff(template.template, args['template'])
        template.template = args['template']
        template.is_modified = True

        db.session.add(template)
        db.session.commit()
        auditlog(
            event='template.update',
            actor=session['user'].username,
            data={
                'template_name': template_name,
                'template_changes': changes
            }
        )

        return self.make_response('Template {} has been updated'.format(template_name))
922567
protected function buildTemplateIndex()
    {
        // We'll iterate the template paths and find
        // any routable templates. Note that if there is
        // more than one directory, the earlier directories
        // are checked first, then on down the stack to
        // mimic the behavior of Twig_Loader_Filesystem.

        if (false === $this->templateIndexBuilt) {
            foreach ($this->templatePath as $path) {
                $dir = new \RecursiveDirectoryIterator($path);
                $it = new \RecursiveIteratorIterator($dir);

                foreach ($it as $template_file) {
                    if ($this->validateTemplate($template_file)) {

                        // Strip the path from the template file relative to
                        // the root template directory to get the template "route"
                        $template_full_path = $template_file->getPathname();
                        $template_rel_path = str_replace($path, '', $template_full_path);
                        $template_route = '/' . $template_rel_path;

                        if (!array_key_exists($template_route, $this->templateIndex)) {
                            $this->debug(sprintf('buildTemplateIndex: Routable Template %s Found at %s.', $template_rel_path, $template_full_path));

                            $template = new Template($template_rel_path, $template_full_path);
                            $this->templateIndex[$template_route] = $template;
                        }
                    }
                }
            }

            $this->templateIndexBuilt = true;
        }
    }
748922
def templates(self):
        """"""
        template = lib.EnvGetNextDeftemplate(self._env, ffi.NULL)

        while template != ffi.NULL:
            yield Template(self._env, template)

            template = lib.EnvGetNextDeftemplate(self._env, template)
1160195
def find_templates(self):
        
        paths = set()
        for loader in self.get_loaders():
            try:
                module = import_module(loader.__module__)
                get_template_sources = getattr(
                    module, 'get_template_sources', loader.get_template_sources)
                template_sources = get_template_sources('')
                paths.update([t.name if isinstance(t, Origin) else t for t in template_sources])
            except (ImportError, AttributeError):
                pass
        if not paths:
            raise CommandError(
                "No template paths found. None of the configured template loaders provided template paths")
        templates = set()
        for path in paths:
            for root, _, files in os.walk(str(path)):
                templates.update(os.path.join(root, name)
                                 for name in files if not name.startswith('.') and
                                 any(name.endswith(ext) for ext in self.template_exts))
        if not templates:
            raise CommandError(
                "No templates found. Make sure your TEMPLATE_LOADERS and TEMPLATE_DIRS settings are correct.")
        return templates
774252
def list
      print_template = lambda { |path|
        puts "  #{File.basename(path)}"
      }

      say "Builtin templates:", :green
      Config.builtin_templates(&print_template)

      say "Installed templates:", :green
      Config.installed_templates(&print_template)
    end
88687
private function buildTemplateList($templatesConfig)
    {
        $templateNamespace = self::DEFAULT_TEMPLATES;
        if (is_string($templatesConfig)) {
            $templateNamespace = $templatesConfig;
        }
        $templatesList = [];
        foreach (self::$templates as $name => $extensions) {
            foreach ($extensions as $extension) {
                $file = $name.'.'.$extension;
                $templatesList[$file] = $templateNamespace.':'.$file;
            }
        }
        // TODO add resources controller traits templates ? (like new_child.html)
        if (is_array($templatesConfig)) {
            $templatesList = array_merge($templatesList, $templatesConfig);
        }
        return $templatesList;
    }
1300411
def inputtemplates(self):
        """"""
        l = []
        for profile in self.profiles:
            l += profile.input
        return l
1026923
def _get_template_dirs():
    """"""
    return filter(lambda x: os.path.exists(x), [
        # user dir
        os.path.join(os.path.expanduser('~'), '.py2pack', 'templates'),
        # system wide dir
        os.path.join('/', 'usr', 'share', 'py2pack', 'templates'),
        # usually inside the site-packages dir
        os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates'),
    ])
933470
def user_list(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    ret = {}
    for user in kstone.users.list():
        ret[user.name] = dict((value, getattr(user, value, None)) for value in dir(user)
                              if not value.startswith('_') and
                              isinstance(getattr(user, value, None), (six.string_types, dict, bool)))
        tenant_id = getattr(user, 'tenantId', None)
        if tenant_id:
            ret[user.name]['tenant_id'] = tenant_id
    return ret
1349819
def _render_template(param, username):
    '''
    
    '''
    env = Environment()
    template = env.from_string(param)
    variables = {'username': username}
    return template.render(variables)