Attributes

We use as many of the semantic HTML5 elements as possible, which is why the actual data is wrapped in an article tag. For machine readability, some item* properties are attached. You can read more about this in this recipe's See also section.

Now, focus on the t-attf-class attribute here. This will be evaluated by QWeb to be the class attribute with the contents evaluated as a format string. That is, the string row book- is passed as it is, and the contents of the #{...} snippet are evaluated as Python code. This is different from t-att-dateCreated (note the missing 'f', the first is an attribute format string, the latter an evaluation) used below, where the whole content is evaluated as Python code. Both forms just pass the part of their name after the second dash as the name of the attribute to be constructed.

It is pretty much up to you when to choose a t-attf-* construction and when to use
t-att-*, the rule of thumb is to use a format string if the result contains a lot of string literals anyway and an evaluation otherwise.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.27.45