Colin wrote:
> Can someone explain what this line in master.kid does (it's after the
> 'flash' div):
> <div py:replace="[item.text]+item[:]"/>

First, rember this is being called in the context of a py:extends, and
you have matched a BODY tag in the extending template. item is the
matched BODY element. So, what this is saying, is in the extending
template, replace this div with the body text (item.text) and any nodes
that might be found in the body (item[:]).  Or, in simpler terms, dump
all of the stuff in the body of the extending template HERE.

> Also, what is the type of the objects contains in the 'item' sequence?

item is an ElementTree Element object.  Slicing it returns a list of
its child ElementTree Elements

> What value does item.text contain?

It will contain any text that appears befor the first child element in
the body (say you had something like (<BODY>Hello world</BODY>). I
believe that wouldn't be valid HTML, but  just to be safe, I suppose it
is included.

> Finally, what is the result of the 'py:attrs="item.items()"' attribute?
>  It is attached to the <head> and <body> match templates.  I've no idea
> what this does.

This puts all attributes that are in the matched element (i.e. HEAD and
BODY) into the final output. items() returns a list of (name, value)
tuples of the Element's attributes.

The py:match and Element documentation (http://tinyurl.com/gtjur) are
where this stuff is documented.  That's not a RTFM response, those were
good questions, and it is often hard to know where the FM is.  Just for
future reference.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to