1
與金字塔的工作,我的代碼看起來是這樣的:TAL嵌套的字典語法
class PageData:
@staticmethod
def create_data():
return [
{
'key_1A': 'info1A',
'key_2A': 'info2A',
'nested_list_A': [
{'nested_key1A': 'nested_val1A'},
{'nested_key2A': 'nested_val2A'},
],
},
{
'key_1A': 'info1B',
'key_2A': 'info2B',
'nested_list_B': [
{'nested_key1B': 'nested_val1B'},
{'nested_key2A': 'nested_val2A'},
],
},
]
而且我的HTML頁面的代碼如下所示:
<span tal:condition="nested_key1A"> Open </span>
<span tal:condition="not nested_key1A"> Closed </span>
什麼是正確的語法來引用nested_key?對於tal:條件語句?