Odd... it should *technically* extend from the last seen version of
extend regardless of where it is located.

Also, I don't understand how this worked pre 1.80 either.

The templates are parsed before any of the python statements are even
known or executed, this just should have never worked.

I also don't see an obvious way of making this work, since the
template would have to know the context of python as its parsing.

Try re-designing how you handle this.

in controllers.py or models.py
# Just assign a variable to the name of the template you want to extend
response.printMode = 'layoutPrint.html' if
request.vars.get('printMode', None) else 'layout.html'

in templates.py
{{extend response.printMode}}

--
Thadeus





On Fri, Aug 13, 2010 at 10:31 AM, Paul Gerrard
<p...@gerrardconsulting.com> wrote:
> Hi,
>
> I have a lot of views in my system with the following code at the top
> of the view html:
>
> {{import string}}
>
> {{if request.vars and 'printMode' in request.vars:}}
> {{printMode=request.vars['printMode']}}
> {{else:}}
> {{printMode=None}}
> {{pass}}
>
> {{if printMode:}}
> {{extend 'layoutPrint.html'}}
> {{else:}}
> {{extend 'layout.html'}}
> {{pass}}
>
> ... the rest of the layout HTML etc.
>
> In version 1.79.1 it worked fine. If there was no printMode var in the
> query string, I got the standard layout. If there was a PrintMode var,
> I got a simpler layout without the headers, menus etc. for printing..
>
> In 1.82.1 it doesn't work at all. It looks like neither layout is
> invoked and all my pages look terrible with no formatting (because no
> CSS) at all.
>
> Any suggestions (or I'll ave to regress back to 1.79.1). :O(
>

Reply via email to