From 695a61f80a3dd3a2b632e1e3784a54d4a7d89a10 Mon Sep 17 00:00:00 2001 From: Mike Bayer <mike_mp@zzzcomputing.com> Date: Fri, 9 Mar 2007 21:03:12 +0000 Subject: [PATCH] - <%include> plus arguments is also programmatically available via self.include_file(<filename>, **kwargs) --- CHANGES | 3 +++ lib/mako/runtime.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 62b7d7d..ac42c4f 100644 --- a/CHANGES +++ b/CHANGES @@ -9,9 +9,12 @@ propigates __nonzero__ method so it evaulates to False if not present, True otherwise. this way you can say % if caller:\n ${caller.body()}\n% endif - <%include> has an "args" attribute that can pass arguments to the called template (keyword arguments only, must be declared in that page's <%page> tag.) +- <%include> plus arguments is also programmatically available via +self.include_file(<filename>, **kwargs) - further escaping added for multibyte expressions in %def, %call attributes [ticket:24] + 0.1.3 - ***Small Syntax Change*** - the single line comment character is now *two* hash signs, i.e. "## this is a comment". This avoids a common diff --git a/lib/mako/runtime.py b/lib/mako/runtime.py index fa9403e..bf1f7a0 100644 --- a/lib/mako/runtime.py +++ b/lib/mako/runtime.py @@ -158,9 +158,9 @@ class Namespace(object): kwargs.setdefault('type', self.template.cache_type) return self.template.module._template_cache.get(key, **kwargs) - def include_file(self, uri): + def include_file(self, uri, **kwargs): """include a file at the given uri""" - _include_file(self.context, uri, self._templateuri) + _include_file(self.context, uri, self._templateuri, **kwargs) def _populate(self, d, l): for ident in l: -- GitLab