**** BEGIN LOGGING AT Thu Aug 26 12:44:57 2004 | ||
-->You are now talking on #schooltool | 12:44 | |
---Topic for #schooltool is www.schooltool.org || IRC logs at http://stone.tuttlesvc.org:880/logbot/ | 12:44 | |
---Topic for #schooltool set by mgedmin at Fri Jul 16 18:15:52 2004 | 12:44 | |
-TomLogging-This channel is logged - http://stone.tuttlesvc.org:880/logbot/ | 12:44 | |
---#schooltool :[freenode-info] please register your nickname...don't forget to auto-identify! http://freenode.net/faq.shtml#nicksetup | 12:44 | |
-->alga (~alga@office.pov.lt) has joined #SchoolTool | 13:32 | |
-->jinty (~jinty@80.28.103.53) has joined #schooltool | 16:02 | |
---You are now known as mg|lunch | 17:23 | |
<--alga has quit ("leaving") | 17:24 | |
<--jinty has quit (Read error: 110 (Connection timed out)) | 17:41 | |
---You are now known as mgedmin | 18:29 | |
-NickServ-Password accepted - you are now recognized | 18:29 | |
---services. sets mode +e mgedmin | 18:29 | |
-MemoServ-You have no new memos | 18:29 | |
-->jinty (~jinty@80.28.65.106) has joined #schooltool | 19:15 | |
jinty | Hi, anyone have some time? Id like to check if I understand how interfaces and testing works in schooltool? | 19:20 |
---|---|---|
mgedmin | sure, go ahead | 19:20 |
jinty | basically Ive written some really basic examples id like to explain to check my understanding | 19:21 |
jinty | let me get them | 19:21 |
jinty | First you write an interface describing the aspects of the object you want to make public. Such as | 19:22 |
jinty | # | 19:22 |
jinty | #Constraints on timetables | 19:22 |
jinty | # | 19:22 |
jinty | class IConstraint(Interface): | 19:22 |
jinty | """Interface for constraints""" | 19:22 |
jinty | def getType(): | 19:22 |
jinty | """Return the type of constraint. | 19:23 |
jinty | The object must return what type of constraint it is. | 19:23 |
jinty | """ | 19:23 |
jinty | for, lest say a constraint on a timetable (hypothetical) | 19:23 |
jinty | Then, a test for that interface, such as: | 19:24 |
jinty | class TestConstraint(unittest.TestCase): | 19:24 |
jinty | def test_types(self): | 19:24 |
jinty | const = constraints.Constraint() | 19:24 |
jinty | availconst = constraints.AvailabilityConstraint() | 19:24 |
jinty | 19:24 | |
jinty | self.assertEqual(const.getType(),"") | 19:24 |
jinty | self.assertEqual(availconst.getType(),"avail") | 19:24 |
jinty | and finally the classes which provide that interface | 19:25 |
jinty | such as: | 19:25 |
jinty | class Constraint: | 19:25 |
jinty | """Base Class for all constraints""" | 19:25 |
jinty | 19:25 | |
jinty | implements(IConstraint) | 19:25 |
jinty | constraint_type = "" | 19:25 |
jinty | 19:25 | |
jinty | def getType(self): | 19:25 |
jinty | return self.constraint_type | 19:25 |
jinty | pass | 19:25 |
jinty | class AvailabilityConstraint(Constraint): | 19:25 |
jinty | """Class for availability constraints""" | 19:25 |
jinty | implements(IConstraint) | 19:26 |
jinty | constraint_type = "avail" | 19:26 |
jinty | And then hopefully everything works and carries on working | 19:26 |
jinty | ? | 19:26 |
mgedmin | no | 19:27 |
mgedmin | you need to test each class | 19:27 |
mgedmin | wait, I misunderstood | 19:27 |
mgedmin | yes, your code is all right | 19:28 |
mgedmin | though we usually write separate unit tests for each class | 19:28 |
mgedmin | rather than lumping them together | 19:28 |
jinty | Ok, then a matter of coding style? | 19:28 |
mgedmin | OTOH if you have a bunch of very short and similair classes, what you wrote is perfectly acceptable | 19:29 |
mgedmin | there's also a useful function called verifyObject | 19:29 |
mgedmin | from zope.interface.verify import verifyObject | 19:29 |
mgedmin | then you can check if an object implements the interface | 19:29 |
mgedmin | verifyObject(constraints.Constraint(), IConstraint) | 19:30 |
jinty | thanks, I will have a look at it... | 19:30 |
mgedmin | this will catch simple errors like forgetting an argument or misspelling a method name | 19:30 |
jinty | Ok, important too... | 19:30 |
jinty | any other points that I seem to be missing? | 19:31 |
mgedmin | no, I don't think so | 19:32 |
jinty | Thanks for the comments. At least I know I understand correctly. | 19:34 |
mgedmin | no problem | 19:35 |
jinty | Also a little bit about organization, do you know if anyone is working on writing wrappers for open source timetablers? (tablix, FET) | 19:35 |
mgedmin | Tom Hoffman would know, but he's not here now | 19:39 |
mgedmin | I haven't heard about anything of that sort | 19:39 |
jinty | Ok, no worries, I'll send him a mail. | 19:39 |
jinty | But thanks for the comments... | 19:40 |
<--thisfred has quit ("Farewell, cruel channel...") | 20:17 | |
<--SteveA has quit ("Leaving") | 20:37 | |
<--jinty has quit ("using sirc version 2.211+KSIRC/1.3.10") | 21:22 | |
-->BradB (~bradb@modemcable156.194-131-66.mc.videotron.ca) has joined #schooltool | 22:57 | |
BradB | Hi. | 22:57 |
BradB | I'm taken to understand that you guys know a fair bit about libxml2 error handling. I've borrowed some code from SchoolTool to do the libxml2 error handling in Silva. Can you guys confirm that libxml2.parseDoc does *not* call the error handler callback? | 22:58 |
mgedmin | hi | 23:00 |
mgedmin | I'm not sure | 23:00 |
mgedmin | I think it does, but I don't really remember | 23:00 |
mgedmin | have you tried using Martijn's lxml? | 23:01 |
BradB | No, it suffers that same problems I'm trying to code around now. | 23:01 |
BradB | i.e. that libxml2 produces nasty error output, so I'm grabbing the text from the error handling and passing that as the value to an exception, to hopefully be more useful to the user. | 23:02 |
BradB | It works fine in applyStyleSheet and parseStyleSheetDoc, but even tracing it down with pdb, I can see the callback is not getting called when it's a parseDoc error. | 23:03 |
*mgedmin shrugs | 23:04 | |
mgedmin | we usually register an error handler that ignores everything | 23:04 |
BradB | ah :) | 23:04 |
mgedmin | or prints the error to a log file | 23:04 |
mgedmin | in most cases it is not interesting | 23:04 |
mgedmin | I have seen comprehensive error messages in our unit tests | 23:05 |
mgedmin | which use libxml2.createPushParser | 23:05 |
mgedmin | look at normalize_xml | 23:05 |
mgedmin | in schooltool.tests.helper | 23:05 |
mgedmin | in schooltool.tests.helpers | 23:05 |
*BradB looks | 23:09 | |
BradB | Hm, it returns "PARSE ERROR: 76" with the XML: <?xml version="1.0" encoding="UTF-8" ?>\n<fo xmlns="http://foo"></foo> :) | 23:13 |
-->th1a (~hoffman@kivahancraig.wireless.telerama.com) has joined #schooltool | 23:13 | |
mgedmin | ah | 23:23 |
mgedmin | comprehensive == long (it copies the full input stream) | 23:24 |
mgedmin | it was a while since I last saw that message | 23:24 |
-->coastGNU (~templin@dynadsl-080-228-67-109.ewetel.net) has joined #schooltool | 23:24 | |
BradB | mgedmin: Sorry, to clarify, the only thing it actually returns is "PARSE ERROR: 76" :) | 23:26 |
mgedmin | ah, so the rest was added by me explicitly | 23:29 |
mgedmin | sorry for making you chase clouds | 23:29 |
BradB | no! the "with the XML: ..." was me saying "here's the XML I tested it with." :) | 23:31 |
th1a | mgedmin: is there supposed to be a file at src/schooltool/translations/schooltool.pot ? | 23:44 |
coastGNU | mgedmin: Any idea wher to find the pot file, can't see it via viewcws | 23:44 |
mgedmin | make extract-translations | 23:45 |
th1a | Ah. | 23:45 |
mgedmin | the file is automatically generated by i18nextractor | 23:45 |
mgedmin | the README should mention this; it doesn't, it's a bug | 23:45 |
th1a | So you need to download the whole package and build it. | 23:45 |
coastGNU | mgedmin: OK, so I have to checkout cvs first | 23:46 |
mgedmin | I suppose we could generate it when making a release tarball | 23:46 |
mgedmin | but in general generated files are not supposed to be checked into the repository | 23:46 |
th1a | Of course. | 23:46 |
th1a | It might be handy in a release. | 23:46 |
mgedmin | coastGNU: I could send you the file if it would be more convenient | 23:46 |
mgedmin | but it changes all the time as the set of translatable strings change | 23:47 |
coastGNU | I think my bandwith shoud be big enough for download cvs (4MBit fibre) | 23:47 |
coastGNU | How do you handle CVS access for upload? | 23:48 |
mgedmin | commits? we use svn+ssh | 23:49 |
coastGNU | And do you have some kind of dictionary to ensure a consistent translation | 23:49 |
mgedmin | are you talking about translation into a particular language? | 23:50 |
coastGNU | Never worked with subversion so far, it's a chance for further learning (c: | 23:50 |
th1a | It isn't hard. | 23:51 |
mgedmin | if you've worked with CVS, subversion will be a breeze | 23:51 |
th1a | http://svnbook.red-bean.com/svnbook/ch01s07.html | 23:51 |
coastGNU | Language, German I would suppose. Platt/Frieslaan is not as often used, even here in friesland ((c: | 23:51 |
mgedmin | I suppose using a consistent vocabulary would be a good idea | 23:54 |
mgedmin | but we do not have any dictionaries at the time | 23:54 |
mgedmin | you might have already noticed that so far we have no translations either | 23:55 |
mgedmin | I'm testing i18n by building a fake translation with msgfilter that encloses all translated strings in angle brackets | 23:55 |
coastGNU | mgedmin: It's a must I would say, but I don't know how big the pot file is, can't be too big. | 23:55 |
mgedmin | 76kb | 23:55 |
th1a | What do you mean by a dictionary? | 23:56 |
mgedmin | 699 strings | 23:56 |
coastGNU | Dictionary is a bit oversized, it's mor a word list as used by ding | 23:56 |
th1a | Can you give me an example? Does the .pot file do this? | 23:57 |
th1a | As the Ugly American I'm ignorant of i18n... | 23:58 |
coastGNU | Such word list are used aside translation. I saw it the first time for openoffice.org | 23:58 |
mgedmin | as a Lithuanian I know much about i18n but almost nothing about l10n ;) | 23:58 |
coastGNU | If using tools like kbabel the more strings where translated the more help you get | 23:59 |
mgedmin | coastGNU: if you're building a pot file, I suggest running svn up now | 23:59 |
coastGNU | also grut, gnome tool, grand unified translator, goes this way | 23:59 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!