inject few waliki's settings to the context  to be used in templates
964848
def settings(request):
    """"""
    from waliki.settings import WALIKI_USE_MATHJAX      # NOQA
    return {k: v for (k, v) in locals().items() if k.startswith('WALIKI')}
1015749
public final void configureAccess(final Template template, final ApplicationContext context) {
        final Configuration configuration = template.getConfiguration();

        AndAccessAssertion accessAssertion = context.getBean(AndAccessAssertion.class);
        accessAssertion.setPredicates(configuration.getAccessAssertion(), template.getAccessAssertion());
        this.access = accessAssertion;
    }
1280943
def get_templates():
    
    injected = {}
    for name, data in templates.items():
        injected[name] = dict([(k, v % env) for k, v in data.items()])
    return injected
958999
protected void applyContext( ShuttleListBinding binding, Map context ) {
        if( context.containsKey(MODEL_KEY) ) {
            binding.setModel((ListModel) context.get(MODEL_KEY));
        }
        if( context.containsKey(SELECTABLE_ITEMS_HOLDER_KEY) ) {
            binding.setSelectableItemsHolder((ValueModel) context.get(SELECTABLE_ITEMS_HOLDER_KEY));
        }
        if( context.containsKey(SELECTED_ITEMS_HOLDER_KEY) ) {
            binding.setSelectedItemsHolder((ValueModel) context.get(SELECTED_ITEMS_HOLDER_KEY));
        }
        if( context.containsKey(RENDERER_KEY) ) {
            binding.setRenderer((ListCellRenderer) context.get(RENDERER_KEY));
        }
        if( context.containsKey(COMPARATOR_KEY) ) {
            binding.setComparator((Comparator) context.get(COMPARATOR_KEY));
        }
        if( context.containsKey(SELECTED_ITEM_TYPE_KEY) ) {
            binding.setSelectedItemType((Class) context.get(SELECTED_ITEM_TYPE_KEY));
        }
        if( context.containsKey(FORM_ID) ) {
            binding.setFormId((String) context.get(FORM_ID));
        }
    }
684006
def template(tpl, template_adapter=SimpleTemplate, **kwargs):
    '''
    
    '''
    if tpl not in TEMPLATES or DEBUG:
        settings = kwargs.get('template_settings',{})
        lookup = kwargs.get('template_lookup', TEMPLATE_PATH)
        if isinstance(tpl, template_adapter):
            TEMPLATES[tpl] = tpl
            if settings: TEMPLATES[tpl].prepare(settings)
        elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl:
            TEMPLATES[tpl] = template_adapter(source=tpl, lookup=lookup, settings=settings)
        else:
            TEMPLATES[tpl] = template_adapter(name=tpl, lookup=lookup, settings=settings)
    if not TEMPLATES[tpl]:
        abort(500, 'Template (%s) not found' % tpl)
    kwargs['abort'] = abort
    kwargs['request'] = request
    kwargs['response'] = response
    return TEMPLATES[tpl].render(**kwargs)
103995
def render_template(templates_path, template_filename, context):
        """"""
        template_env = Environment(
            autoescape=False, trim_blocks=False,
            loader=FileSystemLoader(str(templates_path)))
        return template_env.get_template(str(template_filename)) \
            .render(context)
1305128
def _set_up_context(cls):
        """"""
        cls.context = AttributeDict()
        cls.context.new_meta = {}
        cls.context.new_transitions = {}
        cls.context.new_methods = {}
670735
private void initIndexVariable(String name, TemplateParserContext context) {
    this.indexVariableInfo = context.addLocalVariable("int", name.trim());
  }
343797
def set_context(context):
    """"""
    global _context
    _context = {k: v for k, v in context.items()}
114586
def init_with_context(self, context):
        
        site_name = get_admin_site_name(context)

        self.children += [
            items.MenuItem(_('Dashboard'), reverse('{0}:index'.format(site_name))),
            items.Bookmarks(),
        ]

        for title, kwargs in get_application_groups():
            if kwargs.get('enabled', True):
                self.children.append(CmsModelList(title, **kwargs))

        self.children += [
            ReturnToSiteItem()
        ]
772273
function(context, descriptor, args) {
		var path = args[0],
			values = (typeof path === 'string') ? context.get(path) : path;
		if (values && values.length) {
			var template = args[1];
			for (var i = 0, len = values.length; i < len; ++i)
				template.toHTMLString(new Context(values[i], context), descriptor);
		} else if (args[2])
			args[2].toHTMLString(context, descriptor);
	}
1103283
def prepare(self, context):
        
        self.params = {}

        # no params, not even a newline
        if not self.nodelist:
            return

        # just static text, no vars, assume one TextNode
        if not self.nodelist.contains_nontext:
            text = self.nodelist[0].s.strip()

        # vars in params, we have to render
        else:
            context.push()
            context['object'] = self.obj
            text = self.nodelist.render(context)
            context.pop()

        if text:
            self.params = self.resolve_params(text)

        # override the default template from the parameters
        if 'template_name' in self.params:
            self.template_name = self.params['template_name']
827650
def inject_context(self, __context_dict__=None, **context):
        
        context = context or __context_dict__
        self.context_keys |= set(context.keys())
        for key, value in context.items():
            setattr(self, key, value)
        for command in self.subcommands.values():
            command.inject_context(context)
398343
def setContext(self, value = .5):
        
        for context in list(self.contextLayers.values()):
            context.resetFlags() # hidden activations have already been copied in
            context.setActivations(value)
81637
def render_template(self, source, **kwargs_context):
        
        """
        return self.jinja_env.from_string(source).render(kwargs_context)
1017885
def _bind(self, args, kwds):
    """"""
    bindings = dict(kwds)
    for i, arg in enumerate(args):
      bindings[i + 1] = arg
    used = {}
    ancestor = self.ancestor
    if isinstance(ancestor, ParameterizedThing):
      ancestor = ancestor.resolve(bindings, used)
    filters = self.filters
    if filters is not None:
      filters = filters.resolve(bindings, used)
    unused = []
    for i in xrange(1, 1 + len(args)):
      if i not in used:
        unused.append(i)
    if unused:
      raise datastore_errors.BadArgumentError(
          'Positional arguments %s were given but not used.' %
          ', '.join(str(i) for i in unused))
    return self.__class__(kind=self.kind, ancestor=ancestor,
                          filters=filters, orders=self.orders,
                          app=self.app, namespace=self.namespace,
                          default_options=self.default_options,
                          projection=self.projection, group_by=self.group_by)
566121
def _get_template(settings):
    
    puts("\nPick a template\n")
    template = None
    while not template:
        _list_templates(settings)
        index = raw_input("\nWhich template would you like to use? [1] ")
        if not index:
            index = "1"
        try:
            index = int(index) - 1
            return settings.config["project_templates"][index]
        except:
            puts("\"{0}\" isn't a valid option!".format(colored.red("{0}".format(index))))
            pass