I found a strange thing in ZPT and I'd like you to confirm whether the bug is in ZPT or in my understanding ...<br>I'd like to put in the 'value' attribute of an input tag a value depending on the content of a member variable.
<br><br>If I use the following code :<br>&nbsp;&nbsp;&nbsp; &lt;input class=&quot;string&quot; type=&quot;text&quot; name=&quot;last&quot; tal:attributes=&quot;value python:test(request['member']=='NEW','new',request['member'])&quot;&gt;
<br>everything is OK and I get the following results :<br>&nbsp;&nbsp; [path]?member=NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&gt; new<br>&nbsp;&nbsp; [path]?member=member_00000000&nbsp;&nbsp;&nbsp; --&gt; member_00000000<br><br>but if I use the following code :<br>&nbsp;&nbsp;&nbsp; &lt;input class=&quot;string&quot; type=&quot;text&quot; name=&quot;last&quot; tal:attributes=&quot;value python:test(request['member']=='NEW','new',context[request['member']].LastName)&quot;&gt;
<br>I get the following results which are wrong :<br>&nbsp;&nbsp; [path]?member=NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&gt; Error Type: KeyError&nbsp; /&nbsp; Error Value: 'NEW'<br>&nbsp;&nbsp; [path]?member=member_00000000&nbsp;&nbsp;&nbsp; --&gt; DE OLIVEIRA<br><br>I don't understand why the 'true' part of the test() generated an error while I have just changed the 'false' part of it (and this 'false' part is valid as I get a good result when 'member' is not 'NEW') ?
<br><br>So, is it a bug and if so, is there a workaround ?<br>Thank you for your help,<br><br>pascal de oliveira<br><br>