IRC logs of #tryton for Wednesday, 2008-08-27 #tryton log beginning Wed Aug 27 00:00:01 CEST 2008
-!- b52laptop(n=b52lapto@ has joined #tryton02:32
-!- b52laptop(n=b52lapto@ has joined #tryton02:36
-!- yangoon( has joined #tryton05:19
-!- Timitos(n=Timitos@ has joined #tryton07:38
-!- nicoe( has joined #tryton09:13
-!- cedk(n=ced@gentoo/developer/cedk) has joined #tryton09:48
-!- cedk_( has joined #tryton09:53
-!- bechamel( has joined #tryton09:59
-!- Gedd( has joined #tryton11:03
CIA-56tryton: C?dric Krier <> default * 878:9511a700a0ef trytond/ (5 files in 3 dirs): Rename trytond into server to avoid duplicate trytond module name11:20
CIA-56tryton: C?dric Krier <> default * 179:29329b6fc817 account/ Rename trytond into server11:20
CIA-56tryton: C?dric Krier <> default * 709:b6f09b515662 tryton/tryton/gui/window/ Remove window from action datas11:20
CIA-56tryton: C?dric Krier <> default * 710:a5d967e209b8 tryton/ (5 files in 2 dirs): Rename tryton in client to avoid double tryton module name11:20
cedknicoe, Gedd: you told us that you want to use locale for translation11:21
cedkdid you make some test with locale and threading?11:21
cedkI think it is not really thread safe11:22
nicoe'locale' is a builtin python ...11:24
nicoedid you meant gettext ?11:24
cedknicoe: I mean when you call locale.set_locale()11:25
cedknicoe: I think that it changes the locale for all the process and not only for the thread11:25
nicoeyep you're probably right about that ...11:27
nicoequoting "setlocale() is not thread safe on most systems"11:28
cedknicoe: ok11:29
cedknicoe: it is because I just have to fix an issue11:29
cedknicoe: and now I need to have a global lock when modify the locale11:29
nicoeouch ...11:30
cedknicoe: we call only in reports and once for one specific view (not often called)11:31
nicoewhere do you use that ?11:31
cedknicoe: in report to format date and numbers11:33
nicoeok just like in the exemple I gave you some time ago11:33
cedkI use locale.format11:33
nicoethis is indeed nice but I did not realized it was not threadsafe11:34
cedknicoe: yes of course, it is the only way, I find to have numbers formated correctly11:35
nicoeindeed, otherwise you would have to use your own implemantation (and it's ugly) but the lock is not so fine either.11:37
cedknicoe: yes, we can add the number and date formating in the ir.lang object11:39
cedkbechamel: ping11:39
-!- b52laptop(n=b52lapto@ has joined #tryton11:40
cedkand we must send it to the client also to have the same formatting11:41
bechamelcedk: the lock will only block other reports or it may lock other queries ?11:43
cedkbechamel: other call to the function formatLang11:43
cedkbechamel: so only other reports11:43
cedkbut I'm not sure that it is the only function that use locale11:44
cedkbecause logging message are localized11:44
cedkso it doesn't fix all11:44
bechamelcedk: you python himself as the gil11:44
bechamelcedk: it should be nice if we could define atomic section of code11:45
bechamelcedk: what happen when a thread can't acquire the lock ?11:46
cedkbechamel: it waits11:47
cedkbut I think that a solution where we define formating on the ir.lang object is good11:48
cedkbecause I have already seen in Tiny some French that didn't want the french formatting11:48
CIA-56tryton: C?dric Krier <> default * 879:0aa75c0df6d4 trytond/trytond/ir/module/ Don't restart pooler if there is no module to update11:51
CIA-56tryton: C?dric Krier <> default * 880:1c8a8897e8f6 trytond/trytond/tests/
CIA-56tryton: Don't force to install modules already installed11:51
CIA-56tryton: Fix delete of wizard11:51
CIA-56tryton: C?dric Krier <> default * 180:db2a27ea17e9 account/tests/ ( Initial tests module11:51
cedkand others people, what do you think about this issue?11:51
bechamelcedk: the solution with ir.lang will allow to avoid the lock ?11:52
cedkbechamel: for now, I don't know how to make a function to format correctly a number without using locale11:53
cedkbechamel: but we will find :-)11:53
nicoeaccording to the "do it once" karma it would be better to use locale11:56
cedkwe need to have a syntax to reprensented that 1000.25 into 1,000.25 or 1 000,25 etc...11:56
cedknicoe: yes but if it is uggly11:56
cedknicoe: and there is the issue when client want other formating than the standard11:57
nicoehu ?11:57
nicoeif the client wants another formatting it should say so ... you can then use this information to correctly set the locale11:57
nicoeBut I agree that the lock it impose on the reports is ugly11:58
nicoe(and not only on the report but everywhere else)11:58
cedknicoe: but it doesn't necessary match with one standard locale11:58
nicoedo you have an example ?11:59
nicoebecause french people that wants english number can use LC_NUMERIC11:59
nicoethus for the user you have to keep some informations related to his prefered choices: LC_NUMERIC, LC_WHATEVER ...12:00
cedknicoe: somes want '.' to separate thousand, someothers nothing and someothers just ' '12:00
nicoethat's precisly what LC_* are made for12:01
cedknicoe: it doesn't depend of the user but of the configuration of the server12:01
nicoenot necessarly12:01
nicoeyou could call set_locale with the preference of the user that way wherever he goes he finds the interface in its language with his formatting12:02
cedknicoe: but in a company, you want that all is printed in a standard way12:03
nicoeThen you don't need locale ...12:03
nicoeor rather : a global locale is good enough12:03
cedknicoe: no because we must handle multi-language12:05
cedknicoe: or we can have 2 db for 2 company with different formatting policy12:05
nicoejust store the LC_NUMERIC/LC_MONETARY and stuff like that in the db12:06
bechamelcedk: one can fetch thousands separator, decimal point, etc at boot time for all the lang in the db (one can imagnie doing that one for all and put it in the xml) then it shouldnt be too difficult ot write a number fomating function12:07
cedkbechamel: you can not retreive the formating rule from locale12:08
nicoebechamel you will never be as good to this kind of stuff as the locale module (that relies on the underlying C library I suppose)12:08
bechamelcedk: locale.localeconv()12:09
cedkbechamel: ok, but it doesn't allow to change it from the standard12:10
bechamelcedk: what do you want to change ?12:12
cedkbechamel: french people that want to have space as separator of thousand by example12:12
nicoecedk just use this: locale.setlocal(locale.LC_ALL, ''); locale.setlocal(LC_MONETARY, 'en_GB.UTF-8')12:13
nicoeand then locale.localeconv() will return the correct data for them12:13
cedknicoe: ok, and how do you explain to the user how to set up this ?12:15
nicoeyou don't ... you store this information in the database and the user just have to specify in a form those information12:16
cedknicoe: but there is thousand of locales12:17
cedkand this doesn't fix the non-threadsafe behavior of locale12:18
cedkfor me if it is buggy, don't use it12:18
cedkI think we can handle the same functionnality of locale in 80lines of code12:19
nicoeThere is hundreds of countries and you're shipping a list of them ... why not doing the same for the locale ?12:19
nicoeI do not say that you have to use locale but that you can use bechamel's proposal to get the data about how to create the function replacing locale.format12:20
bechamelcedk: if you put locales data in the db you dont need locales.format anymore of course12:20
cedkbechamel: yes and we can write thread safe code12:21
nicoebechamel: I was quicker12:21
cedkof course we can take data from locale12:21
bechamelcedk: actualy the best would be to find this kind of list online, i don't want ot install all the locales on my laptop only to fetch some , vs . vs space convensions12:21
cedkbut for now we only have 3 languages12:21
bechamelnicoe: i though that cedk would understand by himself :) so i was waiting before answering (coffee someone ?)12:22
cedkit is not necessary to format numbers in language for which we don't have any translation12:22
nicoetranslators probaly have their locale installed you could ask them to create the data.12:22
cedkso is everybody agreed with this solution:12:25
cedkcreating our own locale.format function that is threadsafe12:25
cedkusing value defined in ir.lang object12:26
cedkfill with the value find in locale12:26
nicoeit seems reasonable while the locale module is broken12:27
bechamelcedk: +112:27
cedkI will start :-)12:28
cedkby the way, with the last push, I think everybody will have some problems12:28
cedkit just needs to remove the tryton.pyc and trytond.pyc12:29
cedkputting formating on ir.lang seems very logical as we already have direction (ltr and rtl)12:30
cedkdo I need to separate currency formating and number formating ?12:31
nicoeI asked a question about locale on #python, we'll see if they have a better idea12:32
bechamelcedk: for currency whe will have to handle something like $200 and 200€12:32
nicoecedk: locale does it, it feels unecessary12:32
bechamelcedk: if the format fun has a currency=None in the definition, i think it's enough no need to do 2 functions12:33
cedkin fact locale have for each params one for number and one for currency12:34
cedkI suppose that it can have some country where you don't display number with the same rules if it currency12:34
cedkbut the currency position must be defined on the currency and not on the language12:35
nicoe nicoe: no, you can't have different threads have different environments. locale settings are part of the process.12:37
nicoefrom #python (it was written before you arrived cedk)12:37
cedknicoe: ok thx12:37
cedkso we really need to remove the use of locale12:38
nicoeit seems it is12:38
cedknicoe: and for you, I don't know how you will use gettext as it based on locale12:38
nicoenicoe: that, or don't rely on locales at all, or put a lock around the locale setting, using and unsetting so only one thread will execute that block at any given time.12:39
nicoeanother response12:39
cedkyes that what I do, but for performences it is bad12:40
nicoecedk: gettext is using locale only in a few places12:41
nicoeand not to do any formatting12:41
nicoeonly to get the encoding12:42
cedknicoe: yes but for the language12:42
cedkgettext need to know which db to use12:43
nicoeindeed but it does not have to rely on the locale know wich file to load12:45
nicoeanyway, I'll go eat ... brb12:46
udonoI found strange problems in report generation: In one installation of tryton I can create my invoices very well, in another installation all textframes are collapsed together. Any clue?13:54
udonoThe failing report generation seems to overwrite the textframe width with very small numbers.13:57
nicoeudono: can you isolate this in relatorio or in tryton ?13:59
udononicoe: Ok, I install the relatoriodevel on both machines14:00
Geddcedk: nicoe, bechamel: regarding the locale problem, Babel already solves that problem. If you don't want to add a dependency you might look at their code and copy/paste the relevant parts.14:22
cedkGedd: thx, but it doesn't solve the customization issue14:24
Geddwhat customization?14:24
Gedd(I didn't read the whole log)14:25
udononicoe: there are strange problems in installing relatorio... I did it via symlink to the relatorio egg folder, but I have an error:
cedkGedd: allow the user to define its own formatting rules14:28
nicoeI'll take a look14:28
nicoeudono: in the file /usr/lib/python2.5/site-packages/relatorio-0.2.0-py2.5.egg/EGG-INFO/entrypoints.txt you have to change odt by opendocument14:31
udonothanks nicoe14:31
Geddcedk: well, I personally think it's really a VERY rare use case. People usually want to use a specific locale, possibly a different locale for numbers than for text. Besides, Babel *does* support custom format strings to be given, so I really don't see the problem here14:33
cedkGedd: I don't think it is a rare use case. People have preference on how numbers must be formatted14:34
Geddthis is apparently a new feature in Bable 0.9 though14:34
cedkespecially on invoice14:34
udononicoe: tryton seems no longer like relatorio :-(14:35
udononicoe: But I think its just the call14:36
Geddcedk: scratch that last comment, I misread the doc14:36
udononicoe: IC if I may repair it14:36
CIA-56tryton: udono roundup * #284/TypeError: __call__() takes exactly 1 non-keyword argument (2 given): [new] Traceback (most recent call last): File "/trytond/", line 336, in run res = method(*msg[2:]) File "/trytond/web_service/rep ...14:40
nicoeIf you're using the tip version of relatorio this is probably due to the fact that I changed the signature of the reports.14:42
CIA-56tryton: udono roundup * #284/TypeError: __call__() takes exactly 1 non-keyword argument (2 given): [chatting] this error happens when I use the new relatorio development version14:43
udononicoe: yes, in the tests is another api to call them14:44
CIA-56tryton: nicoe roundup * #284/TypeError: __call__() takes exactly 1 non-keyword argument (2 given): This is indeed a change in the signature of relatorio reports.14:45
udononicoe: I dont know how to repair, sorry14:48
nicoeudono: what is the call exacty ?14:49
udonoline 411 nicoe14:52
nicoeudono: replace line 414 by "localcontext['o']=objects\ndata=rel_report(**localcontext).render.getvalue()"14:55
nicoeit should work14:55
cedknicoe: it is not a very clear change I find15:01
cedknicoe: instead of being explicit, it becomes implicit15:02
nicoeWhat becomes implicit ?15:03
cedknicoe: the object15:04
nicoeIn fact we're getting closer to the genshi way of making things15:04
cedknicoe: and that it is 'o'15:04
nicoeIt's way more explicit that way. Because before in your report you had a variable 'o' coming from nowhere. Now I made this explicit15:05
nicoeMoreover, this way I can pass the context from a report to a subreport (chart in opendocument for now)15:05
udononicoe: doesn't work. I changed to with error
cedknicoe: and why is it call 'o'15:06
nicoeudono can you paste the line 117 from relatorio/ please ?15:07
nicoecedk: I suppose you named it that way in your reports15:08
nicoecedk: But I might be wrong15:08
udono nicoe15:08
nicoecedk: I did not took a look15:08
nicoeudono: thanks15:08
nicoeudono: it looks like you're not using this file. Because in this file the report does not require any non-keyword argument15:12
udononicoe: hmm15:13
nicoeudono moreover you forgot the parenthesis after render in tryton15:13
udononicoe: ok, sorry15:14
udononicoe: strange, it seems that I use the right files...15:24
nicoeudono: do you get the same traceback ?15:25
udononicoe maybe this helps,
nicoein the bug report it says "TypeError: __call__() takes exactly 1 non-keyword argument (2 given)" and in the pasted traceback "TypeError: __call__() takes exactly 2 non-keyword arguments (1 given)"15:26
nicoeudono: yes I think that there is a confusion between the two installed version of relatorio15:27
udononicoe: with corrected parenthesis this error come:
nicoeI guess the relatorio installed in /usr/lib/.... is not the tip15:28
cedkudono: I think you must have only one *15:28
udonocedk: on localcontext?15:28
udonocedk: or one relatorio?15:29
udonoI have just one relatorio15:29
nicoeI only have one relatorio ?15:29
udononicoe: ... installed15:30
nicoeok I understood15:31
nicoethe datafactory from tryton is coherent with the report15:31
nicoeyou should change the signature of the __call__15:32
nicoein the datafactory15:33
nicoeor in line 41215:33
udononicoe: how?15:33
nicoeyou replace the reportfactory by relatorio.DefaultFactory15:34
CIA-56tryton: udono roundup * #285/AttributeError: 'module' object has no attribute 'DefaultFactory': [new] Traceback (most recent call last): File "/trytond/", line 336, in run res = method(*msg[2:]) File "/trytond/web_service/rep ...15:36
CIA-56tryton: udono roundup * #285/AttributeError: 'module' object has no attribute 'DefaultFactory': [chatting] This error comes when I: you replace the reportfactory by relatorio.DefaultFactory ok I understood 15:32 » the datafactory from tryt ...15:37
udononicoe: doesnt work15:37
nicoeudono I sent you an email15:39
udononicoe: ok, thanks15:40
CIA-56tryton: udono roundup * #286/Client will no longer start: [new] tryton-forest/tryton$ bin/tryton Traceback (most recent call last): File "bin/tryton", line 10, in <module> import tryton.main File ...15:52
udononicoe: I needed to update Tryton for your report, now the client will not start...15:52
nicoeI just did a hg fetch, edited the file and sent it to you ...15:53
udononicoe: so we need to debug later the reporting problem...15:53
udononicoe: Thanks15:54
CIA-56tryton: ced roundup * #286/Client will no longer start: [resolved] remove tryton.pyc15:58
CIA-56tryton: udono roundup * #286/Client will no longer start: [chatting] Next error following uspallek@Lisa:~/workspace/tryton-forest/tryton$ bin/tryton Traceback (most recent call last): File "bin/tryton ...16:02
CIA-56tryton: C?dric Krier <> default * 711:fcbfdc54c4ab tryton/bin/tryton: Fix typo for issue28616:12
CIA-56tryton: ced roundup * #286/Client will no longer start: [resolved] Fix with changeset fcbfdc54c4ab16:17
-!- yangoon( has joined #tryton16:46
-!- yangoon( has left #tryton16:47
cedkI have got the format and currency function working with information on ir.lang and currency.currency16:53
cedknow I need to update all the reports16:53
cedkand modify the client to use these values16:56
-!- rli( has joined #tryton16:57
-!- yangoon( has joined #tryton17:07
-!- e-ane( has joined #tryton17:09
CIA-56tryton: udono roundup * #287/AttributeError: 'module' object has no attribute 'DefaultFactory': [new] Traceback (most recent call last): File "/trytond/", line 336, in run res = method(*msg[2:]) File "/trytond/web_service/rep ...17:32
CIA-56tryton: udono roundup * #287/Relatorio devel: AttributeError: 'module' object has no attribute 'DefaultFactory': [chatting] When I like to print the new letter report in Relationship > party this error rise up. I think it depends to relatorio devel. This repo ...17:35
udonocedk: Thanks, Tryton now run again :-)17:35
udononicoe: the standard reports work, now, but the addon reports have problems with relatorio see issue28717:36
nicoecedk, bechamel: did you look at babel for the locale stuff ? Seems pretty neat to me.(
CIA-56tryton: C?dric Krier <> default * 881:a8f69b7cd030 trytond/trytond/ (ir/ ir/lang.xml report/
CIA-56tryton: Modify formatLang to use ir.lang and currency.currency object for formatting17:37
CIA-56tryton: Remove global lock17:37
CIA-56tryton: C?dric Krier <> default * 181:26e19339aa60 account/ (6 files):17:37
CIA-56tryton: Remove global lock17:37
CIA-56tryton: Fix reports for new formatLang17:37
CIA-56tryton: C?dric Krier <> default * 98:acf32873d33b account_invoice/invoice.odt: Fix report for new formatLang17:37
CIA-56tryton: C?dric Krier <> default * 50:5ae33b837635 company/letter.odt: Fix report for new formatLang17:37
CIA-56tryton: C?dric Krier <> default * 17:b4bc042206cf currency/ ( currency.xml): Add formatting fields17:37
CIA-56tryton: C?dric Krier <> default * 75:996acabb7925 purchase/purchase.odt: Fix report for new formatLang17:37
CIA-56tryton: C?dric Krier <> default * 195:bea73daf7a9d stock/packing_out.odt: Fix report for new formatLang17:37
cedknicoe: I just push our own locale method, it takes 155 SLOC for number and currency formating17:38
CIA-56tryton: ced roundup * #287/Relatorio devel: AttributeError: 'module' object has no attribute 'DefaultFactory': [resolved] Not a tryton bugs It seems it is a bad installation.17:42
nicoecedk: too bad. But speaking strictly about SLOC "from babel.numbers import format_number"17:43
CIA-56tryton: ced roundup * #284/TypeError: __call__() takes exactly 1 non-keyword argument (2 given): [resolved] Use the release. We can not change Tryton to follow the tip of relatorio, we will do for release.17:43
CIA-56tryton: nicoe roundup * #287/Relatorio devel: AttributeError: 'module' object has no attribute 'DefaultFactory': [chatting] My bad in the file I sent you I should have used "relatorio.reporting.DefaultFactory" instead of "relatorio.DefaultFactory"17:45
nicoebeats 155 SLOC :)17:45
cedknicoe: it doesn't format currency17:47
cedknicoe: and doesn't allow to group with different numbers17:48
cedkso we have more functionality :-)17:48
nicoecedk: with different numbers ?17:48
nicoecedk: Fabien sort de ce corps !!17:49
CIA-56tryton: ced roundup * #285/AttributeError: 'module' object has no attribute 'DefaultFactory': I don't understand what you are doing?17:49
cedknicoe: yes, like this: [3, 3, 6]17:50
cedknicoe: I don't know who is using this but locale allows17:50
nicoeIt formats this way I gues 123 456 78901217:50
cedknicoe: yes17:50
nicoeyou can do it17:50
nicoewith babel17:50
nicoeusing the format keyword17:51
CIA-56tryton: C?dric Krier <> default * 882:f57b90eadbb9 trytond/trytond/report/ Improve relatorio import for futher release17:54
CIA-56tryton: nicoe roundup * #285/AttributeError: 'module' object has no attribute 'DefaultFactory': udono, a quick advice : you should not use tryton's roundup to report stuffs we are debugging together from relatorio tip17:55
cedknicoe: it miss a ','17:56
nicoecedk: the last one is 6 digits long and all the others are 3 this is what I expected ...17:57
nicoewhat did you meant ?17:57
cedknicoe: there is '.##'17:58
cedknicoe: so I think it must end with 4,9817:58
cedknicoe: and you must know the lenght of the result to construct the format template17:59
nicoecedk, no this is an integer no decimal part17:59
cedknicoe: so why the first have ','18:00
nicoecedk: you don't have to know the length of the result18:00
nicoecedk just tried it with others numbers it works18:01
cedknicoe: and babel is 5.9M18:01
nicoethe first , is there to show that there is a repetition of three digits18:01
cedknicoe: if we want to provide a executable that run directly, it is too big18:02
nicoecedk: the heavy part is the data from the locale18:02
cedknicoe: yes of course18:02
nicoemoreover what is 5.9M on today's DD18:02
cedknicoe: I think about networks18:02
nicoeWhich network ? you do not transfer those data ?18:03
cedkit is too distibute the client on network18:03
nicoeIf it is an heavy client then it will have pygtk, python, etc18:04
nicoeso adding a dependancy is not that heavy18:05
CIA-56tryton: C?dric Krier <> default * 883:c741398091fa trytond/trytond/ir/lang.xml: Add missing date in form view19:34
CIA-56tryton: C?dric Krier <> default * 884:55e8339ba5dd trytond/trytond/ir/ Allow to modify lang from xml19:34
CIA-56tryton: C?dric Krier <> default * 885:2bbd82d12dea trytond/trytond/res/ Add locale in user preferences19:34
CIA-56tryton: C?dric Krier <> default * 712:7ee2d5eb95d0 tryton/tryton/ Remove unused code19:34
CIA-56tryton: C?dric Krier <> default * 713:7d0038d7fa88 tryton/tryton/ (8 files in 8 dirs): Handle locale from user preference19:34
cedkso now the client use the locale parameters define on his language19:36
-!- nicoe( has left #tryton19:42
CIA-56tryton: C?dric Krier <> default * 886:a76ec8b4d64f trytond/trytond/ir/ Add check date on ir.lang19:45
-!- Gedd(n=ged@ has joined #tryton20:38
CIA-56tryton: udono roundup * #287/Relatorio devel: AttributeError: 'module' object has no attribute 'DefaultFactory': [resolved] I bring this Tryton unrelated issue to an end: relatorio up to Version 0.3.0 or hg rev287d6310d2ef7881221eddb65202212bada2e9b7 works fi ...20:55

Generated by 2.11.0 by Marius Gedminas - find it at!