| From | Sent On | Attachments |
|---|---|---|
| Anil | Oct 15, 2007 12:01 pm | |
| Michael Bayer | Oct 15, 2007 12:51 pm | |
| Div Shekhar | Oct 15, 2007 10:04 pm | |
| Michael Bayer | Oct 15, 2007 10:30 pm |
| Subject: | [Mako] Re: conditional inheritance | |
|---|---|---|
| From: | Michael Bayer (mike...@zzzcomputing.com) | |
| Date: | Oct 15, 2007 12:51:19 pm | |
| List: | com.googlegroups.mako-discuss | |
inherit is interpreted before the template is, so youd have to make a global-level function like:
<%!
def inherit(context): if context.get('foo') == 'bar': return '/base.html' else: return None %> <%inherit file="${inherit(context)}"/>
On Oct 15, 2007, at 3:01 PM, Anil wrote:
% if c.no_template: <%inherit file="/base.html"/> % endif
Should doing something like work?
I have a controller that render's a form.html. In that form I have _remote tag (AJAX call), that calls this same template. If I don't have that if condition, the whole inherited template is displayed in this AJAX tag rather than just the template.
form.html: <%inherit file="/base.html"> ${ h.form_remote_tag(url=h.url(controller="/host", action="compare"), update="reportBox") } <div id="reportBox"></div> ...
def compare(self): ... render ('form.html')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Mako
Templates for Python" group.
To post to this group, send email to mako...@googlegroups.com
To unsubscribe from this group, send email to
mako...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mako-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---





