Bonjour, je me permet de vous tenir au courant d'un bug trés embetant mais qui heureusement a sa solution, et ce dans les Zope templates.
voici déjà l'erreur fréquement retourné par zope... et j'ai mis des mois a savoir d'ou ca pouvais venir.
An error was encountered while publishing this resource.
Error Type: UnicodeDecodeError
Error Value: 'ascii' codec can't decode byte 0xe9 in position 5: ordinal not in range(128)
Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering
an error.
For more detailed information about the error, please
refer to the error log.
If the error persists please contact the site maintainer.
Thank you for your patience.
voici un code zpt incriminé:
<span tal:omit-tag="" tal:define="initValue options/initValue | string:a;check options/check | python:False;onclic options/onclic | python:'';id options/id | request/form/id;index options/index | request/form/index | python:'';valeur options/valeur | string:a;lab options/lab | request/form/lab | python:'';pretag options/pretag | request/form/pretag | python:'';name options/name | request/form/name">
<div style="position:relative; min-width:10px; width:auto; z-index:1; margin:2px;margin-right:10px; padding-right:10px;">
<div tal:attributes="onclick python:'Tradio(\''+id+'\')';" style=" min-width:50px; width:auto; height:20px;position:absolute">
<img tal:attributes="id python:id+'Img'" src="/DMPGSv1/module/OBSTETRIQUE/rsc/imgs/x.gif" style="position:absolute"/>
<input type="radio" value="" tal:attributes="id python:id+'hidden';name python:name;checked python:test(check==False and initValue!=valeur,True,False)" style="display:none; position:relative" />
<span tal:content="python:pretag"></span>
<label style="position:relative; right:-20px; top:3px; z-index:-1">
<span tal:content="python:lab"></span>
</label>
</div>
les section en gras génère le code erreur ci dessus dans certain cas. En fait dans le cas ou vous passez une valeur pour "initValue" contenant des carractère spéciaux sans initialiser "valeur" et vice versa.
En effet le constat est que la fonction "string:" encode différement que la fonction "python:"
Donc ce qu'il faut retenir, c'est:
... tal:define="mavariable string:a"...
est différent de... tal:define="mavariable python:'a'"...
pour preuve, dans l'extrait de code ci haut, il suffit de transformer
...tal:define="initValue options/initValue | python:'a';ch...on:'';valeur options/valeur | python:'a';la...e">
et l'erreur disparait.
Dure la vie...