IRC log of #zope3-dev for Friday, 2005-05-06

*** hazmat has quit IRC00:00
*** jeru has left #zope3-dev00:09
*** bskahan_ has quit IRC00:11
*** `anthony has quit IRC00:17
*** Aiste has joined #zope3-dev00:21
projekt01Does anybody know a good source for compare a order of to lists?00:29
*** `anthony has joined #zope3-dev00:30
projekt01The values in the two lists are not equal, I have to check just the order of values which are contained in both lists.00:31
VladDracI don't understand your problem00:34
projekt01I have to compare the order of a list with a order of another list00:35
VladDracorder as in sortedness?00:35
VladDrachow would [1,2,3] and [20, 50, 100] compare?00:35
projekt01This whould be valid00:36
projekt01It means no bad order found00:36
VladDracyou want to check if a list is sorted?00:36
projekt01[1,2,3] and [20, 3, 1, 100] should fail00:37
projekt01The lists don't have the same order for the values "1 and 3"00:38
projekt01Just values contained in both lists have to have the same order, like "1 and 3"00:39
VladDracah ok, so [1,10,4,20] and [2,7,1,9,10,4,77,20] would be valid?00:40
*** Aiste has quit IRC00:41
VladDracwhy the hell do you want this? :)00:42
projekt01Manage directlyProvides interface order00:43
projekt01A kind of object policy00:43
projekt01For additional markers where get added via directlyProvides00:43
projekt01It's a part of a plugin concept00:44
projekt01... this function is just need for unit tests00:44
VladDracinteresting puzzle00:46
projekt01I think I have to write a own compareOrderedListWithDifferentValues function00:46
*** bskahan_ has joined #zope3-dev00:47
projekt01Or better call it compareOrderOfOrderedListWithDifferentValues function ;-)00:47
VladDracwould [1,2,3] and [1,2] be valid?00:50
VladDrachmm guess they would00:51
VladDracthen make them sets, intersect them00:51
VladDrachmm and then what00:51
VladDrachow about [1,2,4] and [1,2,3]?00:52
projekt01Yes, valid00:52
VladDracnever mind this doesn't make sense :) Sets are not ordered00:53
*** SureshZ has left #zope3-dev00:53
*** hazmat has joined #zope3-dev00:53
projekt01Perhaps if pop all items in one list where not found in the other list00:53
projekt01Popall items form list 1 where not found in list 2, and pop all items form list 2 where not found in list 1.00:55
projekt01And then I can compare both lists.00:55
projekt01Hm, this could work, I guess00:55
VladDracI have something I think00:57
VladDrac[x for x in l1 if x in l1 and x in l2] == [x for x in l2 if x in l1 and x in l2]00:58
VladDracwhich is similar to your suggestion btw00:59
projekt01Ah, cool, thanks I try this00:59
VladDracthis is a bit redundant00:59
VladDrac[x for x in l1 if x in l2] == [x for x in l2 if x in l1]00:59
VladDraci.e. take all elements from l1 that are in l2 and all elements from l2 that are in l101:00
VladDracso you end up with the elements that are both in l1 and l2, in the exact same order, which must be similar to be valid01:00
projekt01Yeah! That's usable, thanks a lot.01:01
* VladDrac likes puzzles like this, esp if the solution is elegant01:01
* andrew_m notes VladDrac's name for future reference ;)01:02
projekt01It's really elegant, Now I can delete my 10 lines of code. ;-)01:02
VladDrac(elegant != efficient, usually)01:03
* VladDrac is off to bed, cu01:05
*** J1m has quit IRC01:07
*** bskahan_ has quit IRC01:15
*** GaryPoster has quit IRC01:20
*** srichter has quit IRC01:29
*** niemeyer has quit IRC01:34
*** bskahan_ has joined #zope3-dev01:59
*** bskahan_ has quit IRC02:27
*** hazmat has quit IRC03:40
*** stub has joined #zope3-dev03:44
*** GaryPoster has joined #zope3-dev03:45
*** projekt01 has left #zope3-dev04:11
*** RaFromBRC has quit IRC05:14
*** GaryPoster has quit IRC06:42
*** GaryPoster has joined #zope3-dev06:43
*** GaryPoster has quit IRC07:07
*** viyyer has joined #zope3-dev07:56
*** philiKON has quit IRC08:04
*** stub has quit IRC08:57
*** stub has joined #zope3-dev08:58
*** hdima has joined #zope3-dev09:16
*** markusl has joined #zope3-dev09:29
*** viyyer has quit IRC09:55
*** viyyer has joined #zope3-dev09:56
*** __gotcha has quit IRC10:18
*** __gotcha has joined #zope3-dev10:38
*** markusl has left #zope3-dev10:53
*** hazmat has joined #zope3-dev10:56
*** stub has quit IRC11:09
*** hazmat has quit IRC11:12
*** projekt01 has joined #zope3-dev12:02
*** mkerrin has joined #zope3-dev12:29
*** The|uni has joined #zope3-dev12:30
*** mgedmin has joined #zope3-dev12:30
*** mgedmin has quit IRC12:31
*** faassen has joined #zope3-dev12:59
*** tarek has joined #zope3-dev13:21
*** `anthony has quit IRC13:22
*** `anthony has joined #zope3-dev13:23
*** __gotcha is now known as __gotchaway13:39
*** gintas has joined #zope3-dev14:02
*** ignas_ has joined #zope3-dev14:37
*** srichter has joined #zope3-dev14:46
*** ChanServ sets mode: +o srichter14:49
hdimasrichter: hi14:51
srichterI am just looking through your checkins14:51
hdimaI've just discovered what MessageID's from tal:content will be translated whenever i18n:translate is given14:53
srichteryes :-)14:53
srichterthat's what I tried to tell you yesterday :-)14:53
hdimaso I think we don't need XXX in zope.po :-)14:53
srichterok, cool14:54
srichternix it then :-)14:54
srichterwhatever you wanna do; I trust that you understand the issue to do it right ;-)14:55
hdimaif MsgID's will be translated without explicit i18n:translate so we just need to know about mix tal:content and i18n:translate14:56
hdimaif there is 'XXX' in zope.pot then somebody mix tal:content and i18n:translate.14:58
srichtermessage ids are not automatically translated and should not either15:00 you just don't understand my first line... :)15:01
srichterso the mix of tal:content and i18n:translate is not very often used (because we try to keep human-readable strings in ZPT), but it is a common pattern that is frequently used15:01
hdimaTALInterpreter.do_isertText_tal() do the automatic translation15:01
srichterhdima: right, I misread15:01
srichterI think we should bring this problem up on the mailing list15:02
srichterI know some people were advocating for automatic translation, but I have been heavily countering this15:02
hdimaif we just disable automatic translation then we need to change more PT's15:04
srichterhdima: are you positive it does the translation automatically?15:04
srichterI think automatic translation should be disabled15:04
hdimaI think that automatic translation wolud be helpfull15:05
projekt01hdima, I have problems with the Cyrillic letters in the PlacefulSetup. I use this folder names in a XML and I get encoding errors.15:05
*** mgedmin has joined #zope3-dev15:05
srichterhdima: but sometimes I do not want anything to be translated on purpose; then I have no chance of turning it off15:06
srichterI really think we need to disable automatic translation15:06
hdimaprojekt01: encoding errors?15:07
projekt01I can't print the folder names15:07
projekt01Ah, no the path15:07
hdimaprojekt01: in XML you need to use UTF-8 names15:08
projekt01Not the names in the XML, the names where I get from keys = list(container.keys())15:08
projekt01The names of the items of the "folder1_1_1"15:09
hdimasrichter: the problem needs some thoughts...15:10
srichtercould you write a mail to the mailing list?15:10
hdimasrichter: ok15:10
hdimaprojekt01: it's unicode names...15:11
projekt01You mean this "\N{CYRILLIC SMALL LETTER PE}"15:11
hdimaprojekt01: yes15:12
projekt01What's the real folder name of  "\N{CYRILLIC SMALL LETTER PE}" is this translated somwhere?15:13
projekt01If so, I don't use the z3 translation files.15:14
hdima"\N{CYRILLIC SMALL LETTER PE}" it's just one letter. :-) See zope/app/rotterdam/tests/output/test1.xml for example15:15
projekt01Yes, I see the output but that's not "\N{CYRILLIC SMALL LETTER PE}". Is there a implicit translation somewhere?15:17
hdimaDo you mean something like this u'\u043f\u0430\u043f\u043a\u0430'?15:18
projekt01Yup, I can't encode this.15:18
hdimaYou always can do u'\u043f\u0430\u043f\u043a\u0430'.encode("utf-8")15:20
hdimafor example15:20
projekt01Ok, I try this. Thanks a lot.15:21
projekt01hdima, I get the following error during encoding:15:30
projekt01UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)15:30
projekt01If I use traversPath.encode("utf-8")15:30
*** Aiste has joined #zope3-dev15:45
*** niemeyer has joined #zope3-dev15:48
hdimaprojekt01: What is the type(traversPath)?15:50
projekt01hdima, <type 'unicode'>15:53
mgedminare you sure about that?15:53
mgedminI don't think you can ever get a UnicodeDecodeError from a unicode object -- you only get them from str objects15:54
hdimaI'm not sure...15:54
projekt01I tried this: dummy = xmlEscape(u'<collection name=%s/>', traversPath) and get the error message:15:54
projekt01  File "C:\Python23\lib\encodings\", line 18, in encode15:54
projekt01    return codecs.charmap_encode(input,errors,encoding_map)15:54
projekt01UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-23: character maps to <undefined>15:54
projekt01The error before raised with: dummy = xmlEscape(u'<collection name=%s/>', traversPath.encode("UTF-8"))15:57
hdimaprojekt01: xmlEscape() now accept unicode strings so you don't need to encode()15:58
mgedminah, then it is xmlEscape that throws the UnicodeDecodeError when it gets a UTF-8 encoded str16:07
hdimamgedmin: yes, unicode > utf-8 str > unicode :-)16:08
mgedminwhat is the 'charmap' coded and where is it used?16:08
projekt01mgedmin, I get the following traceback for unicode:16:10
projekt01  File "C:\Python23\lib\encodings\", line 18, in encode16:10
projekt01    return codecs.charmap_encode(input,errors,encoding_map)16:10
projekt01UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-23: character maps to <undefined>16:10
hdimamgedmin: seems like some python (on windows?) related error for me...16:10
projekt01I don't think so, the tests in rotterdam.xmlobject are OK.16:11
mgedminwhere does cp850 come from?16:12
projekt01I can't belive it, I use the mehtod xmlEscape and the same name of the folder. In the rotterdam.xmlobject it's working in my class not.???16:12
*** gintas has quit IRC16:14
hdimaprojekt01: What is sys.getdefaultencoding() returns?16:14
mgedminprojekt01, can you paste the full traceback to, e.g.,
projekt01What's that ""?16:15
projekt01Sys.getdefaultencoding returns: sys.getdefaultencoding()16:16
projekt01sys.getdefaultencoding()  ascii16:16
hdimaprojekt01: strange... so what the cp850 then...16:17
projekt01mgedmin, Ok, the posting is up on
hdimaprojekt01: try xmlEscape(u"%s", u"\043f")16:18
mgedmincp850 is sys.stdout.encoding16:18
mgedmintry print repr(dummy) instead of print dummy16:18
mgedminPython will give you exceptions if you print Unicode strings that are not representable in your system encoding16:19
*** SureshZ has joined #zope3-dev16:19
projekt01Print repr(dummy) returns:16:20
projekt01dummy  u'<collection name="\u043f\u0430\u043f\u043a\u04303" traversPath="/\u043f\u0430\u043f\u043a\u04303" />'16:20
projekt01But then I raise into the real error in check_xml():
mgedminwhat did you expect to get?16:21
projekt01Normaly the check_xml compares the results if they are different.16:22
projekt01In the traceback16:22
projekt01Ah, perhaps it's just a problem there?16:22
mgedminif you replace ("XML Output Changed:\n%s\n\n%s" % (s1, s2))16:23
mgedminwith ("XML Output Changed:\n%r\n\n%r" % (s1, s2))16:23
hdimaprojekt01: so they are different... :)16:23
mgedminyou'll probably see more16:23
mgedminPython exceptions don't work well with Unicode strings, I've noticed16:23
projekt01hdima, Yes, they are different because I started to migrate the new output and use the old xml test file16:24
projekt01mgedmin, where should I use ("XML Output Changed:\n%s\n\n%s" % (s1, s2))16:25
hdimaprojekt01: zope.pagetemplate.tests.utils.check_xml16:27
projekt01Yup, changing to ("XML Output Changed:\n%r\n\n%r" % (s1, s2))16:29
projekt01The zope tests are working also well with this changes.16:34
projekt01hdima, can you commit this changes to the trunk?16:35
projekt01hdima, mgedmin, thanks a lot for your help.16:36
hdimayes, later16:36
*** GaryPoster has joined #zope3-dev16:44
*** bskahan_ has joined #zope3-dev16:54
hdimaprojekt01: just checked in the fix16:58
*** anguenot has joined #zope3-dev17:03
*** J1m has joined #zope3-dev17:03
projekt01hidma, Thanks, the test works except writing the test files.17:07
projekt01If I use this in the test file: name="\u043f\u0430\u043f\u043a\u04303"17:07
projekt01I get the following out put:  name="\\u043f\\u0430\\u043f\\u043a\\u04303"17:07
hdimaprojekt01: yes, backslashes are escaped17:09
hdimaprojekt01: What function do you use for load test files?17:10
projekt01def read_input(filename):17:11
projekt01    import tiks.skintools.zmitreestatefull.tests17:11
projekt01    dir = os.path.dirname(tiks.skintools.zmitreestatefull.tests.__file__)17:11
projekt01    input_dir = os.path.join(dir, 'input')17:11
projekt01    output_dir = os.path.join(dir, 'output')17:11
projekt01    filename = os.path.join(input_dir, filename)17:11
projekt01    return open(filename, 'r').read().decode("utf-8")17:11
hdimaprojekt01: so test files should be in utf-8 encoding17:12
hdimaprojekt01: get 'name' value from rotterdam/tests/output/test01.xml17:12
projekt01Yes, and then17:14
hdimasrichter: I've just sent the mail17:14
hdimaprojekt01: the test file will be loaded and converted to unicode17:16
projekt01Ah, that is this crazy name, thanks it works now.17:18
hdimaThis is utf-8 encoded name... :-)17:20
srichterhdima: thanks17:20
projekt01hdima, Ok, I see, thanks a lot.17:25
*** hdima has quit IRC18:04
*** The|uni has quit IRC18:05
*** __gotchaway is now known as __gotcha18:21
*** srichter has quit IRC18:23
*** bskahan has joined #zope3-dev18:43
*** bskahan_ has quit IRC18:50
*** hazmat has joined #zope3-dev19:35
*** efge has joined #zope3-dev19:40
*** __gotcha is now known as __gotchaway19:48
*** faassen has quit IRC19:53
*** hazmat has quit IRC19:59
*** __gotcha has joined #zope3-dev20:03
*** __gotchaway has quit IRC20:10
*** hazmat has joined #zope3-dev20:26
*** mkerrin has quit IRC20:47
*** efge has left #zope3-dev21:09
*** srichter has joined #zope3-dev21:30
*** ChanServ sets mode: +o srichter21:30
*** __gotcha has quit IRC21:48
*** Aiste has quit IRC21:55
*** hazmat has quit IRC21:59
*** hazmat has joined #zope3-dev22:03
*** mkerrin has joined #zope3-dev22:09
*** mkerrin has quit IRC22:16
*** mgedmin has quit IRC22:28
*** hazmat has quit IRC22:52
*** ignas_ has quit IRC22:52
*** anguenot has quit IRC23:08
*** RaFromBRC has joined #zope3-dev23:18
*** bskahan has quit IRC23:44
*** ignas has quit IRC23:52

Generated by 2.15.1 by Marius Gedminas - find it at!