*** hazmat has quit IRC | 00:00 | |
*** jeru has left #zope3-dev | 00:09 | |
*** bskahan_ has quit IRC | 00:11 | |
*** `anthony has quit IRC | 00:17 | |
*** Aiste has joined #zope3-dev | 00:21 | |
projekt01 | Does anybody know a good source for compare a order of to lists? | 00:29 |
---|---|---|
*** `anthony has joined #zope3-dev | 00:30 | |
projekt01 | The 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 |
VladDrac | I don't understand your problem | 00:34 |
projekt01 | I have to compare the order of a list with a order of another list | 00:35 |
VladDrac | order as in sortedness? | 00:35 |
VladDrac | how would [1,2,3] and [20, 50, 100] compare? | 00:35 |
projekt01 | This whould be valid | 00:36 |
projekt01 | It means no bad order found | 00:36 |
VladDrac | you want to check if a list is sorted? | 00:36 |
projekt01 | [1,2,3] and [20, 3, 1, 100] should fail | 00:37 |
projekt01 | The lists don't have the same order for the values "1 and 3" | 00:38 |
projekt01 | Just values contained in both lists have to have the same order, like "1 and 3" | 00:39 |
VladDrac | ah ok, so [1,10,4,20] and [2,7,1,9,10,4,77,20] would be valid? | 00:40 |
projekt01 | Yup | 00:40 |
*** Aiste has quit IRC | 00:41 | |
VladDrac | why the hell do you want this? :) | 00:42 |
projekt01 | Manage directlyProvides interface order | 00:43 |
projekt01 | A kind of object policy | 00:43 |
projekt01 | For additional markers where get added via directlyProvides | 00:43 |
projekt01 | It's a part of a plugin concept | 00:44 |
projekt01 | ... this function is just need for unit tests | 00:44 |
projekt01 | need/needed | 00:45 |
VladDrac | interesting puzzle | 00:46 |
projekt01 | I think I have to write a own compareOrderedListWithDifferentValues function | 00:46 |
*** bskahan_ has joined #zope3-dev | 00:47 | |
projekt01 | Or better call it compareOrderOfOrderedListWithDifferentValues function ;-) | 00:47 |
VladDrac | would [1,2,3] and [1,2] be valid? | 00:50 |
projekt01 | Yes | 00:51 |
VladDrac | hmm guess they would | 00:51 |
VladDrac | then make them sets, intersect them | 00:51 |
VladDrac | hmm and then what | 00:51 |
VladDrac | how about [1,2,4] and [1,2,3]? | 00:52 |
projekt01 | Yes, valid | 00:52 |
VladDrac | never mind this doesn't make sense :) Sets are not ordered | 00:53 |
*** SureshZ has left #zope3-dev | 00:53 | |
*** hazmat has joined #zope3-dev | 00:53 | |
projekt01 | Perhaps if pop all items in one list where not found in the other list | 00:53 |
projekt01 | Popall 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 |
projekt01 | And then I can compare both lists. | 00:55 |
projekt01 | Hm, this could work, I guess | 00:55 |
VladDrac | I have something I think | 00: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 |
VladDrac | which is similar to your suggestion btw | 00:59 |
projekt01 | Ah, cool, thanks I try this | 00:59 |
VladDrac | wait | 00:59 |
VladDrac | this is a bit redundant | 00:59 |
VladDrac | [x for x in l1 if x in l2] == [x for x in l2 if x in l1] | 00:59 |
VladDrac | i.e. take all elements from l1 that are in l2 and all elements from l2 that are in l1 | 01:00 |
VladDrac | so you end up with the elements that are both in l1 and l2, in the exact same order, which must be similar to be valid | 01:00 |
projekt01 | Yeah! That's usable, thanks a lot. | 01:01 |
* VladDrac likes puzzles like this, esp if the solution is elegant | 01:01 | |
* andrew_m notes VladDrac's name for future reference ;) | 01:02 | |
projekt01 | It's really elegant, Now I can delete my 10 lines of code. ;-) | 01:02 |
VladDrac | :) | 01:03 |
VladDrac | (elegant != efficient, usually) | 01:03 |
* VladDrac is off to bed, cu | 01:05 | |
projekt01 | cu | 01:06 |
*** J1m has quit IRC | 01:07 | |
*** bskahan_ has quit IRC | 01:15 | |
*** GaryPoster has quit IRC | 01:20 | |
*** srichter has quit IRC | 01:29 | |
*** niemeyer has quit IRC | 01:34 | |
*** bskahan_ has joined #zope3-dev | 01:59 | |
*** bskahan_ has quit IRC | 02:27 | |
*** hazmat has quit IRC | 03:40 | |
*** stub has joined #zope3-dev | 03:44 | |
*** GaryPoster has joined #zope3-dev | 03:45 | |
*** projekt01 has left #zope3-dev | 04:11 | |
*** RaFromBRC has quit IRC | 05:14 | |
*** GaryPoster has quit IRC | 06:42 | |
*** GaryPoster has joined #zope3-dev | 06:43 | |
*** GaryPoster has quit IRC | 07:07 | |
*** viyyer has joined #zope3-dev | 07:56 | |
*** philiKON has quit IRC | 08:04 | |
*** stub has quit IRC | 08:57 | |
*** stub has joined #zope3-dev | 08:58 | |
*** hdima has joined #zope3-dev | 09:16 | |
*** markusl has joined #zope3-dev | 09:29 | |
*** viyyer has quit IRC | 09:55 | |
*** viyyer has joined #zope3-dev | 09:56 | |
*** __gotcha has quit IRC | 10:18 | |
*** __gotcha has joined #zope3-dev | 10:38 | |
*** markusl has left #zope3-dev | 10:53 | |
*** hazmat has joined #zope3-dev | 10:56 | |
*** stub has quit IRC | 11:09 | |
*** hazmat has quit IRC | 11:12 | |
*** projekt01 has joined #zope3-dev | 12:02 | |
*** mkerrin has joined #zope3-dev | 12:29 | |
*** The|uni has joined #zope3-dev | 12:30 | |
*** mgedmin has joined #zope3-dev | 12:30 | |
*** mgedmin has quit IRC | 12:31 | |
*** faassen has joined #zope3-dev | 12:59 | |
*** tarek has joined #zope3-dev | 13:21 | |
*** `anthony has quit IRC | 13:22 | |
*** `anthony has joined #zope3-dev | 13:23 | |
*** __gotcha is now known as __gotchaway | 13:39 | |
*** gintas has joined #zope3-dev | 14:02 | |
*** ignas_ has joined #zope3-dev | 14:37 | |
*** srichter has joined #zope3-dev | 14:46 | |
*** ChanServ sets mode: +o srichter | 14:49 | |
hdima | srichter: hi | 14:51 |
srichter | hdima: | 14:51 |
srichter | hi | 14:51 |
srichter | I am just looking through your checkins | 14:51 |
hdima | I've just discovered what MessageID's from tal:content will be translated whenever i18n:translate is given | 14:53 |
srichter | yes :-) | 14:53 |
srichter | that's what I tried to tell you yesterday :-) | 14:53 |
hdima | so I think we don't need XXX in zope.po :-) | 14:53 |
srichter | ok, cool | 14:54 |
srichter | nix it then :-) | 14:54 |
hdima | no... | 14:55 |
srichter | whatever you wanna do; I trust that you understand the issue to do it right ;-) | 14:55 |
hdima | if MsgID's will be translated without explicit i18n:translate so we just need to know about mix tal:content and i18n:translate | 14:56 |
hdima | if there is 'XXX' in zope.pot then somebody mix tal:content and i18n:translate. | 14:58 |
srichter | message ids are not automatically translated and should not either | 15:00 |
hdima | ...so you just don't understand my first line... :) | 15:01 |
srichter | so 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 used | 15:01 |
hdima | TALInterpreter.do_isertText_tal() do the automatic translation | 15:01 |
srichter | hdima: right, I misread | 15:01 |
srichter | really? | 15:02 |
srichter | shrug | 15:02 |
srichter | I think we should bring this problem up on the mailing list | 15:02 |
srichter | I know some people were advocating for automatic translation, but I have been heavily countering this | 15:02 |
hdima | if we just disable automatic translation then we need to change more PT's | 15:04 |
srichter | hdima: are you positive it does the translation automatically? | 15:04 |
srichter | I think automatic translation should be disabled | 15:04 |
hdima | I think that automatic translation wolud be helpfull | 15:05 |
projekt01 | hdima, 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-dev | 15:05 | |
srichter | hdima: but sometimes I do not want anything to be translated on purpose; then I have no chance of turning it off | 15:06 |
srichter | I really think we need to disable automatic translation | 15:06 |
hdima | projekt01: encoding errors? | 15:07 |
projekt01 | I can't print the folder names | 15:07 |
projekt01 | Ah, no the path | 15:07 |
hdima | projekt01: in XML you need to use UTF-8 names | 15:08 |
projekt01 | Not the names in the XML, the names where I get from keys = list(container.keys()) | 15:08 |
projekt01 | The names of the items of the "folder1_1_1" | 15:09 |
hdima | srichter: the problem needs some thoughts... | 15:10 |
srichter | could you write a mail to the mailing list? | 15:10 |
hdima | srichter: ok | 15:10 |
hdima | projekt01: it's unicode names... | 15:11 |
projekt01 | Really? | 15:11 |
projekt01 | You mean this "\N{CYRILLIC SMALL LETTER PE}" | 15:11 |
hdima | projekt01: yes | 15:12 |
projekt01 | What's the real folder name of "\N{CYRILLIC SMALL LETTER PE}" is this translated somwhere? | 15:13 |
projekt01 | If 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 example | 15:15 |
projekt01 | Yes, I see the output but that's not "\N{CYRILLIC SMALL LETTER PE}". Is there a implicit translation somewhere? | 15:17 |
hdima | Do you mean something like this u'\u043f\u0430\u043f\u043a\u0430'? | 15:18 |
projekt01 | Yup, I can't encode this. | 15:18 |
hdima | You always can do u'\u043f\u0430\u043f\u043a\u0430'.encode("utf-8") | 15:20 |
hdima | for example | 15:20 |
projekt01 | Ok, I try this. Thanks a lot. | 15:21 |
projekt01 | hdima, I get the following error during encoding: | 15:30 |
projekt01 | UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128) | 15:30 |
projekt01 | If I use traversPath.encode("utf-8") | 15:30 |
*** Aiste has joined #zope3-dev | 15:45 | |
*** niemeyer has joined #zope3-dev | 15:48 | |
hdima | projekt01: What is the type(traversPath)? | 15:50 |
projekt01 | hdima, <type 'unicode'> | 15:53 |
mgedmin | are you sure about that? | 15:53 |
mgedmin | I don't think you can ever get a UnicodeDecodeError from a unicode object -- you only get them from str objects | 15:54 |
hdima | I'm not sure... | 15:54 |
projekt01 | I tried this: dummy = xmlEscape(u'<collection name=%s/>', traversPath) and get the error message: | 15:54 |
projekt01 | File "C:\Python23\lib\encodings\cp850.py", line 18, in encode | 15:54 |
projekt01 | return codecs.charmap_encode(input,errors,encoding_map) | 15:54 |
projekt01 | UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-23: character maps to <undefined> | 15:54 |
projekt01 | The error before raised with: dummy = xmlEscape(u'<collection name=%s/>', traversPath.encode("UTF-8")) | 15:57 |
hdima | projekt01: xmlEscape() now accept unicode strings so you don't need to encode() | 15:58 |
projekt01 | Yup | 15:58 |
mgedmin | ah, then it is xmlEscape that throws the UnicodeDecodeError when it gets a UTF-8 encoded str | 16:07 |
hdima | mgedmin: yes, unicode > utf-8 str > unicode :-) | 16:08 |
mgedmin | what is the 'charmap' coded and where is it used? | 16:08 |
projekt01 | mgedmin, I get the following traceback for unicode: | 16:10 |
projekt01 | File "C:\Python23\lib\encodings\cp850.py", line 18, in encode | 16:10 |
projekt01 | return codecs.charmap_encode(input,errors,encoding_map) | 16:10 |
projekt01 | UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-23: character maps to <undefined> | 16:10 |
hdima | mgedmin: seems like some python (on windows?) related error for me... | 16:10 |
projekt01 | I don't think so, the tests in rotterdam.xmlobject are OK. | 16:11 |
mgedmin | where does cp850 come from? | 16:12 |
projekt01 | I 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 IRC | 16:14 | |
hdima | projekt01: What is sys.getdefaultencoding() returns? | 16:14 |
mgedmin | projekt01, can you paste the full traceback to, e.g., paste.plone.org? | 16:14 |
projekt01 | What's that "paste.plone.org"? | 16:15 |
projekt01 | Sys.getdefaultencoding returns: sys.getdefaultencoding() | 16:16 |
projekt01 | sys.getdefaultencoding() ascii | 16:16 |
hdima | projekt01: strange... so what the cp850 then... | 16:17 |
projekt01 | mgedmin, Ok, the posting is up on http://paste.plone.org/1750 | 16:17 |
hdima | projekt01: try xmlEscape(u"%s", u"\043f") | 16:18 |
mgedmin | aha! | 16:18 |
mgedmin | cp850 is sys.stdout.encoding | 16:18 |
mgedmin | try print repr(dummy) instead of print dummy | 16:18 |
mgedmin | Python will give you exceptions if you print Unicode strings that are not representable in your system encoding | 16:19 |
*** SureshZ has joined #zope3-dev | 16:19 | |
projekt01 | Print repr(dummy) returns: | 16:20 |
projekt01 | dummy u'<collection name="\u043f\u0430\u043f\u043a\u04303" traversPath="/\u043f\u0430\u043f\u043a\u04303" />' | 16:20 |
projekt01 | But then I raise into the real error in check_xml(): http://paste.plone.org/1751 | 16:21 |
mgedmin | what did you expect to get? | 16:21 |
projekt01 | Normaly the check_xml compares the results if they are different. | 16:22 |
projekt01 | In the traceback | 16:22 |
projekt01 | Ah, perhaps it's just a problem there? | 16:22 |
mgedmin | if you replace ("XML Output Changed:\n%s\n\n%s" % (s1, s2)) | 16:23 |
mgedmin | with ("XML Output Changed:\n%r\n\n%r" % (s1, s2)) | 16:23 |
hdima | projekt01: so they are different... :) | 16:23 |
mgedmin | you'll probably see more | 16:23 |
mgedmin | Python exceptions don't work well with Unicode strings, I've noticed | 16:23 |
projekt01 | hdima, Yes, they are different because I started to migrate the new output and use the old xml test file | 16:24 |
projekt01 | mgedmin, where should I use ("XML Output Changed:\n%s\n\n%s" % (s1, s2)) | 16:25 |
hdima | projekt01: zope.pagetemplate.tests.utils.check_xml | 16:27 |
projekt01 | Yup, changing to ("XML Output Changed:\n%r\n\n%r" % (s1, s2)) | 16:29 |
projekt01 | works | 16:30 |
projekt01 | The zope tests are working also well with this changes. | 16:34 |
projekt01 | hdima, can you commit this changes to the trunk? | 16:35 |
projekt01 | hdima, mgedmin, thanks a lot for your help. | 16:36 |
hdima | yes, later | 16:36 |
*** GaryPoster has joined #zope3-dev | 16:44 | |
*** bskahan_ has joined #zope3-dev | 16:54 | |
hdima | projekt01: just checked in the fix | 16:58 |
*** anguenot has joined #zope3-dev | 17:03 | |
*** J1m has joined #zope3-dev | 17:03 | |
projekt01 | hidma, Thanks, the test works except writing the test files. | 17:07 |
projekt01 | If I use this in the test file: name="\u043f\u0430\u043f\u043a\u04303" | 17:07 |
projekt01 | I get the following out put: name="\\u043f\\u0430\\u043f\\u043a\\u04303" | 17:07 |
hdima | projekt01: yes, backslashes are escaped | 17:09 |
hdima | projekt01: What function do you use for load test files? | 17:10 |
projekt01 | def read_input(filename): | 17:11 |
projekt01 | import tiks.skintools.zmitreestatefull.tests | 17: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 |
hdima | projekt01: so test files should be in utf-8 encoding | 17:12 |
hdima | projekt01: get 'name' value from rotterdam/tests/output/test01.xml | 17:12 |
hdima | ...test1.xml | 17:13 |
projekt01 | Yes, and then | 17:14 |
hdima | srichter: I've just sent the mail | 17:14 |
hdima | projekt01: the test file will be loaded and converted to unicode | 17:16 |
projekt01 | Ah, that is this crazy name, thanks it works now. | 17:18 |
hdima | This is utf-8 encoded name... :-) | 17:20 |
srichter | hdima: thanks | 17:20 |
projekt01 | hdima, Ok, I see, thanks a lot. | 17:25 |
*** hdima has quit IRC | 18:04 | |
*** The|uni has quit IRC | 18:05 | |
*** __gotchaway is now known as __gotcha | 18:21 | |
*** srichter has quit IRC | 18:23 | |
*** bskahan has joined #zope3-dev | 18:43 | |
*** bskahan_ has quit IRC | 18:50 | |
*** hazmat has joined #zope3-dev | 19:35 | |
*** efge has joined #zope3-dev | 19:40 | |
*** __gotcha is now known as __gotchaway | 19:48 | |
*** faassen has quit IRC | 19:53 | |
*** hazmat has quit IRC | 19:59 | |
*** __gotcha has joined #zope3-dev | 20:03 | |
*** __gotchaway has quit IRC | 20:10 | |
*** hazmat has joined #zope3-dev | 20:26 | |
*** mkerrin has quit IRC | 20:47 | |
*** efge has left #zope3-dev | 21:09 | |
*** srichter has joined #zope3-dev | 21:30 | |
*** ChanServ sets mode: +o srichter | 21:30 | |
*** __gotcha has quit IRC | 21:48 | |
*** Aiste has quit IRC | 21:55 | |
*** hazmat has quit IRC | 21:59 | |
*** hazmat has joined #zope3-dev | 22:03 | |
*** mkerrin has joined #zope3-dev | 22:09 | |
*** mkerrin has quit IRC | 22:16 | |
*** mgedmin has quit IRC | 22:28 | |
*** hazmat has quit IRC | 22:52 | |
*** ignas_ has quit IRC | 22:52 | |
*** anguenot has quit IRC | 23:08 | |
*** RaFromBRC has joined #zope3-dev | 23:18 | |
*** bskahan has quit IRC | 23:44 | |
*** ignas has quit IRC | 23:52 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!