Silent "ascii encode exception" when trying to raise an exception with special characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
KDE OpenObject Client |
New
|
Undecided
|
Unassigned |
Bug Description
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 "somethingthatd
- An exception appears ("ValidateError - Error ocurred while validating the field(s) res_model,
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 "somethingthatd
- 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/
res = wid.handlers[
File "/usr/local/
id = self.screen.save()
File "/usr/local/
id = self.currentRec
File "/usr/local/
if not self.rpc.
File "/usr/local/
return session.
File "/usr/local/
return self.call(obj, method, *args)
File "/usr/local/
value = self.connection
File "/usr/local/
result = s.myreceive()
File "/usr/local/
raise Myexception(
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,
(Note: the exception is properly displayed on the GTK client)
description: | updated |
tags: | added: ascii encode exception |
Some extra info using the debugger:
------------
ipdb> res[0] src_model: Nombre de modelo inv\xe1lido en la definici\xf3n de la acci\xf3n',)
Exception(u'warning -- ValidateError\n\nHa ocurrido un error mientras se validaban los campo(s) res_model,
ipdb> str(res[0])
*** UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 123: ordinal not in range(128)
ipdb> unicode(res[0]) src_model: Nombre de modelo inv\xe1lido en la definici\xf3n de la acci\xf3n'
u'warning -- ValidateError\n\nHa ocurrido un error mientras se validaban los campo(s) res_model,
------------
Also, if I replace the "raise Myexception( str(res[ 0]), str(res[1]))" line in tiny_socket.py with the next code, then the exception is properly displayed:
try: res[0]) .encode( 'utf-8' ) res[1]) .encode( 'utf-8' )
res_0 = str(res[0])
res_1 = str(res[1])
except UnicodeEncodeError:
res_0 = unicode(
res_1 = unicode(
raise Myexception(res_0, res_1)