Comment 0 for bug 509572

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

When Koo receives an exception from the server with special (non-ascii) characters, it just fails silently to decode the exception, and the user is never notified that something went wrong.

How to reproduce it (tested on revno 1267):

Set the user language to English, then go to "Administration -> Low Level Objects -> Actions -> Window Actions", select the first item. Try to change the "Object" field to "somethingthatdoesnotexist" and save the record:
     - An exception appears ("ValidateError - Error ocurred while validating the field(s) res_model,src_model: Invalid model name in the action definition.") as it should.

Set the user language to Spanish, then go to "Administración -> Objetos de bajo nive l-> Acciones -> Acciones de ventana", select the first item. Try to change the "Objeto" field to "somethingthatdoesnotexist" and save the record:
    - No exception appears (the user might think that everything went all right... but he is wrong).
    - The document was not saved (on the status bar it displays "Document modified")
    - The next stacktrace is logged on the console:

-----------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Koo/Dialogs/KooMainWindow.py", line 719, in callChildView
    res = wid.handlers[action]()
  File "/usr/local/lib/python2.6/dist-packages/Koo/Dialogs/FormWidget.py", line 347, in save
    id = self.screen.save()
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Screen.py", line 599, in save
    id = self.currentRecord().save(reload=True)
  File "/usr/local/lib/python2.6/dist-packages/Koo/Model/Record.py", line 248, in save
    if not self.rpc.write([self.id], value, context):
  File "/usr/local/lib/python2.6/dist-packages/Koo/Rpc/Rpc.py", line 579, in __call__
    return session.execute('/object', 'execute', self.object, self.func, *args)
  File "/usr/local/lib/python2.6/dist-packages/Koo/Rpc/Rpc.py", line 420, in execute
    return self.call(obj, method, *args)
  File "/usr/local/lib/python2.6/dist-packages/Koo/Rpc/Rpc.py", line 408, in call
    value = self.connection.call(obj, method, *args)
  File "/usr/local/lib/python2.6/dist-packages/Koo/Rpc/Rpc.py", line 187, in call
    result = s.myreceive()
  File "/usr/local/lib/python2.6/dist-packages/Koo/Rpc/tiny_socket.py", line 130, in myreceive
    raise Myexception(str(res[0]), str(res[1]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 123: ordinal not in range(128)
-----------------------------

The exception not shown should have displayed "ValidateError - Ha ocurrido un error mientras se validaban los campo(s) res_model,src_model: Nombre de modelo inválido en la definición de la acción".