Tryton - Issues

 

Issue2970

Title Useless call to decode
Priority feature Status resolved
Superseder Nosy List ced, pilou
Type performance Components tryton
Assigned To Keywords
Reviews

Created on 2013-01-29.01:42:39 by pilou, last changed by pilou.

Files
File name Uploaded Type Edit Remove
issue2970_setup_with_patch_without_chinese.jpg pilou, 2013-03-15.11:53:42 image/jpeg
issue2970_single_with_patch_without_chinese.jpg pilou, 2013-03-15.11:24:13 image/jpeg
issue2970_source_with_patch_without_chinese.jpg pilou, 2013-03-15.11:54:01 image/jpeg
Messages
msg12793 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-03-23.19:27:26
Fixed with changeset e88fd8049175
msg12759 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2013-03-15.12:04:20
On 15/03/13 11:53 +0100, Pierre-Louis Bonicoli wrote:
> "with patch, setup installed in a directory "test é Ü test": OK"
> isn't the same ?

OK.
msg12758 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-03-15.11:53:42
"with patch, setup installed in a directory "test é Ü test": OK"
isn't the same ?

Screenshots added.
msg12757 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2013-03-15.11:39:01
On 15/03/13 11:35 +0100, Pierre-Louis Bonicoli wrote:
> Could you precisely explain how to:
> "So the test must be done on windows with tryton launch from a path including
> non-ascii char." ?

- put tryton directory under a path with non-ascii char.
- cd to tryton directory
- run python bin\tryton
msg12756 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-03-15.11:35:24
Could you precisely explain how to:
"So the test must be done on windows with tryton launch from a path including
non-ascii char." ?
msg12755 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2013-03-15.11:30:11
I don't understand what you are showing with the screenshot.
What I guess I see, is the bundle exe which doesn't run from the directory where
the exe is but from the temp dir.
msg12754 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-03-15.11:24:13
Tests done:

* with patch, single setup copied in a directory "test é Ü test": OK
* with patch, setup installed in a directory "test é Ü test": OK
* without patch, single setup, when a Chinese character is used: NOK fails to
launch ("Error launching installer")
* with patch, single setup, when a Chinese character is used: NOK fails to
launch ("Error launching installer")

So:
* there is no problem with the patch
* there is another problem with the installer and Chinese character
msg12538 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2013-02-18.01:29:15
Indeed it is not sys.getdefaultencoding the problem but sys.getfilesystemencoding.

So the test must be done on windows with tryton launch from a path including
non-ascii char.
msg12537 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-02-18.00:50:41
review: review663004
msg12393 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-01-29.22:55:11
PyGTK sets the default encoding to UTF-8 [1]:

import sys
print sys.getdefaultencoding()
import gtk
print sys.getdefaultencoding()

displays (Linux and windows 7, python2.7):
ascii
utf-8


os.path.join(u"ééééé", 'plop').decode('utf-8')
fails only if gtk is not imported.


PIXMAPS_DIR is unicode because CURRENT_DIR is unicode.


If gtk module was not imported, a right way to do things would be:
fsdecode(os.path.join(fsencode(unicode), str))
with fsdecode & fsencode backported from [2].


By the way if call to "decode" was necessary, should not the following code
raise an exception:
http://hg.tryton.org/tryton/file/a39ea11bf279/tryton/gui/window/tips.py#l57 ?


About 5cfb042367ba: once patch reverted, how could i reproduce the bug fixed by
the patch ?


[1] https://bugzilla.gnome.org/show_bug.cgi?id=132040
[2] http://hg.python.org/cpython/file/02c4ecc87f74/Lib/os.py#l781
msg12385 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2013-01-29.09:32:54
I don't think it must be remove see the rev 5cfb042367ba
More over I see no where in the doc that os.path.join returns always an unicode.
msg12384 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-01-29.01:46:30
review652002
msg12383 (view) Author: [hidden] (pilou) (Tryton committer) Date: 2013-01-29.01:42:37
In http://hg.tryton.org/tryton/file/a39ea11bf279/tryton/gui/window/dblogin.py#l404 :

image.set_from_file(os.path.join(PIXMAPS_DIR, 'tryton.png').decode('utf-8'))

"os.path.join" returns an unicode, so call to "decode" is useless.
History
Date User Action Args
2013-03-23 19:27:26pilousetstatus: chatting -> resolved
messages: + msg12793
2013-03-15 12:04:22cedsetmessages: + msg12759
2013-03-15 11:54:01pilousetfiles: + issue2970_source_with_patch_without_chinese.jpg
2013-03-15 11:53:44pilousetfiles: + issue2970_setup_with_patch_without_chinese.jpg
messages: + msg12758
2013-03-15 11:39:04cedsetmessages: + msg12757
2013-03-15 11:35:26pilousetmessages: + msg12756
2013-03-15 11:30:13cedsetmessages: + msg12755
2013-03-15 11:24:16pilousetfiles: + issue2970_single_with_patch_without_chinese.jpg
messages: + msg12754
2013-02-18 01:29:16cedsetmessages: + msg12538
2013-02-18 00:50:41pilousetmessages: + msg12537

Showing 10 items. Show all history (warning: this could be VERY long)