Skip to content Skip to sidebar Skip to footer

Tal Nested Dictionary Syntax

Working with Pyramid, my code looks like this: class PageData: @staticmethod def create_data(): return [ { 'key_1A': 'info1A',

Solution 1:

In trying to figure this out I found my answer...

tal:repeat Syntax: tal:repeat="name expression"

Description: Evaluates "expression", and if it is a sequence, repeats this tag and all children once for each item in the sequence. The "name" will be set to the value of the item in the current iteration, and is also the name of the repeat variable. The repeat variable is accessible using the TAL path: repeat/name and has the following properties:

https://www.owlfish.com/software/simpleTAL/tal-guide.html

<divtal:repeat="a nest_list_A"><divtal:repeat="b a.nest_list_A"><spantal:condition="b.nested_key1A">

a becomes the assignment for nest_list_A eg b becomes the assignment for a.nested_list_A which will then access they key

if there is a value for the key, then tal:condition will continue as normal, otherwise it will skip while rendering.

Post a Comment for "Tal Nested Dictionary Syntax"