Simple as that :) thanks Massimo Web2py is fantastic 

On Tuesday, 17 July 2012 22:45:48 UTC+1, Massimo Di Pierro wrote:
>
> replace
>
> return dict(ReturnedDict = OtherDict) 
>
> with
>
> return locals()
>
> On Tuesday, 17 July 2012 16:40:00 UTC-5, adohertyd wrote:
>>
>> In my function page2(): I return a dictionary to be accessed by the page2 
>> HTML view. In the page2 function I have some other dictionaries. What I 
>> want to do to be able to use the non-returned dictionaries in the HTML code 
>> to show some items. This is a sample of what I want: Hope it's clear
>>
>> def page2():
>>
>>
>> Dict1 = {key1:{keyA:value, keyB:value, keyC:value}
>> Dict2 = {key2:{keyD:value, keyE:value, keyF:value}
>>
>> OtherDict = {key:value, key:value...}
>>
>> return dict(ReturnedDict = OtherDict)
>>
>>
>> page2.html:
>>
>>
>> <ul>
>> {{for x in ReturnedDict:}}
>> {{if x in Dict1:}}
>> <li>{{=Dict1[x]['keyA']}}{{=Dict1[x]['keyB']</li>
>> {{elif x in Dict2:}}
>> <li>{{=Dict2[x]['keyD']}}{{=Dict2[x]['keyE']</li>
>> {{pass}}
>> </ul>
>>
>>
>>

-- 



Reply via email to