> 3/ Templating
>
> a/ Is template inheritance supported? (I couldn't find any reference,
> but it might be caused by being tired)
Template inheritance as done by Django is ill-defined and I can
explain more.
You can do
{{extend 'another_template'}}
You can
{{include 'another_template'}}
You can create functions to define blocks before {{extend ...}}. This
is explained in the manual.
> b/ Is it possible to invoke Python functions from the template that
> are enhancing the template dictionary?
Yes if:
1) you define the function in models or
2) you define the funciton in controller and pass it to the view or
3) you import the function from the view
4) you create the function in the view {{def f(a)}}<h1>Helloe {{=a}}</
h1>{{return}}
> Imagine a homepage that has a couple of 'widget' like fragments. These
> are not really part of the controller, so I'd like to just say in the
> template: invoke a function and place add the returned value to the
> dict used for rendering the template.
>
> c/ Is it possible to include in a template an HTML fragment generated
> as a result of a function invocation?
Yes {{=XML(fragment)}}
> It is a similar concept to the above one, the difference being that
> the 'widget' template is completely outside the current page (while in
> the above scenario the 'widget' template was part of the current
> template)
>
> 4/ Request/Response cycle interceptors
>
> Basically this is a way to plug in cross-cutting functionality that
> will be automatically triggered at specific moment of the request/
> response cycle:
>
> - before_request
> - before_controller
> - after_controller
> - before_view
> - after_view
> - after_request
You can do most of this this. In controller place
def mycaller(f):
before_controller()
d=f()
after_controller()
if isinstance(d,dict): d=response.render(d)
after_view()
response._caller=mycaller
You can still do before request and after request using wsgi
middleware.
I apologize for my sketchy responses but I am on vacation and I have
limited connectivity. I suggest you ask your questions again in April.
Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---