Ticket #3171: inclusion_tag.diff
File inclusion_tag.diff, 1.2 KB (added by , 18 years ago) |
---|
-
__init__.py
845 845 self.tag(func.__name__, compile_func) 846 846 return func 847 847 848 def inclusion_tag(self, file_name, context_class=Context, takes_context=False):848 def inclusion_tag(self, template_name, context_class=Context, takes_context=False, inclusion_params=None): 849 849 def dec(func): 850 850 params, xx, xxx, defaults = getargspec(func) 851 851 if takes_context: … … 865 865 else: 866 866 args = resolved_vars 867 867 868 if inclusion_params: 869 c, i = {}, 0 870 for arg in args: 871 c[params[i]] = arg 872 i = i + 1 873 resolved_params = [resolve_variable(var, c) for var in inclusion_params] 874 file_name = template_name % tuple(resolved_params) 875 else: 876 file_name = template_name 877 868 878 dict = func(*args) 869 879 870 880 if not getattr(self, 'nodelist', False):