[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

<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>


  <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>



How can we force id to be interpreted as a string for the dictionary key
in the first case?


More information about the Zope mailing list