[Zope] int's as keys for dictionaries
Bryce Harrington
bryce at osdl.org
Tue May 25 21:15:09 EDT 2004
I'm running into an issue I don't understand when using ints as keys in
hashes.
<dtml-let d_test_parameter="{'1':'a', '2':'b'}">
<p>We set id="1"</p>
<dtml-let id="1">
<p>This works: <dtml-var "d_test_parameter.get('1')"></p>
<p>But this doesn't: <dtml-var "d_test_parameter.get(id)"></p>
<p>Nor does this: <dtml-var "d_test_parameter.get('id')"></p>
</dtml-let>
<p>Now set id="'1'"</p>
<dtml-let id="'1'">
<p>This works: <dtml-var "d_test_parameter.get('1')"></p>
<p>Now this works: <dtml-var "d_test_parameter.get(id)"></p>
<p>This still doesn't: <dtml-var "d_test_parameter.get('id')"></p>
</dtml-let>
</dtml-let>
How can we force id to be interpreted as a string for the dictionary key
in the first case?
Thanks,
Bryce
More information about the Zope
mailing list