I'd like to put in the 'value' attribute of an input tag a value depending on the content of a member variable.
If I use the following code :
<input class="string" type="text" name="last" tal:attributes="value python:test(request['member']=='NEW','new',request['member'])">
everything is OK and I get the following results :
[path]?member=NEW --> new
[path]?member=member_00000000 --> member_00000000
but if I use the following code :
<input class="string" type="text" name="last" tal:attributes="value python:test(request['member']=='NEW','new',context[request['member']].LastName)">
I get the following results which are wrong :
[path]?member=NEW --> Error Type: KeyError / Error Value: 'NEW'
[path]?member=member_00000000 --> DE OLIVEIRA
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') ?
So, is it a bug and if so, is there a workaround ?
Thank you for your help,
pascal de oliveira
_______________________________________________ ZPT mailing list [email protected] http://mail.zope.org/mailman/listinfo/zpt
