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> <input class="string" type="text" name="last" tal:attributes="value python:test(request['member']=='NEW','new',request['member'])">
<br>everything is OK and I get the following results :<br> [path]?member=NEW --> new<br> [path]?member=member_00000000 --> member_00000000<br><br>but if I use the following code :<br> <input class="string" type="text" name="last" tal:attributes="value python:test(request['member']=='NEW','new',context[request['member']].LastName)">
<br>I get the following results which are wrong :<br> [path]?member=NEW --> Error Type: KeyError / Error Value: 'NEW'<br> [path]?member=member_00000000 --> 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>