Indeed, the fact that {{include ...}} and {{extend ...}} can't be
conditional is a problem if you need that. But if you meant your
template to be inherited from, it's not really a problem.
This is the decorator I'm currently using: http://paste.pocoo.org/show/149598/
.

You use it (in 'controller') like

@call_super(c='othercontroller')
def somerequestfunc():
    return dict(somevar='something')

to have 'somerequestfunc' in 'othercontroller' called and have its
dict merge with this 'somerequestfunc'. You can adjust the
application, controller, request function, and indicate whether to use
the request, response and session object from the current request.

For this to be useful 'theapp/controllers/controller/
somerequestfunc.html' should extend 'theapp/controllers/
othercontroller/somerequestfunc.html'.

On Nov 9, 4:39 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> {{include ...}} end {{extend ...}} cannot be conditional because they
> would prevent bytecode compilation. I would be interesting in seeing
> how you are using decorators now. It may give us ideas for
> improvement.
>
> On Nov 9, 4:31 am, eggy_ <markflorisso...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > when I have two templates, A and B, where A extends B. How can I call
> > "super" from A's request function. With "super" I mean "execute the
> > controller that corresponds with B and optionally have its dict
> > automatically merge with the dict that is returned from A's request
> > function".
> > I'm currently using a decorator to do this. It optionally takes the
> > request, response and sesson objects and passes them to the other
> > controller via exec_environment. It then executes B's request
> > function, then A's request function, and merges and returns the
> > result. However, I think there should be an easier and better way to
> > do this.
>
> > Mark
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to