IRC log of #schooltool for Thursday, 2004-08-26

**** BEGIN LOGGING AT Thu Aug 26 12:44:57 2004
-->You are now talking on #schooltool12:44
---Topic for #schooltool is || IRC logs at
---Topic for #schooltool set by mgedmin at Fri Jul 16 18:15:52 200412:44
-TomLogging-This channel is logged -
---#schooltool :[freenode-info] please register your nickname...don't forget to auto-identify!
-->alga ( has joined #SchoolTool13:32
-->jinty (~jinty@ has joined #schooltool16:02
---You are now known as mg|lunch17:23
<--alga has quit ("leaving")17:24
<--jinty has quit (Read error: 110 (Connection timed out))17:41
---You are now known as mgedmin18:29
-NickServ-Password accepted - you are now recognized18:29
---services. sets mode +e mgedmin18:29
-MemoServ-You have no new memos18:29
-->jinty (~jinty@ has joined #schooltool19:15
jintyHi, anyone have some time? Id like to check if I understand how interfaces and testing works in schooltool?19:20
mgedminsure, go ahead19:20
jintybasically Ive written some really basic examples id like to explain to check my understanding19:21
jintylet me get them19:21
jintyFirst you write an interface describing the aspects of the object you want to make public. Such as19:22
jinty#Constraints on timetables19:22
jinty# 19:22
jintyclass 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
jintyfor, lest say a constraint on a timetable (hypothetical)19:23
jintyThen, a test for that interface, such as:19:24
jintyclass 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
jintyand finally the classes which provide that interface19:25
jintysuch as:19:25
jintyclass 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_type19:25
jinty    pass19:25
jintyclass AvailabilityConstraint(Constraint):19:25
jinty    """Class for availability constraints"""19:25
jinty    implements(IConstraint)19:26
jinty    constraint_type = "avail"19:26
jintyAnd then hopefully everything works and carries on working19:26
mgedminyou need to test each class19:27
mgedminwait, I misunderstood19:27
mgedminyes, your code is all right19:28
mgedminthough we usually write separate unit tests for each class19:28
mgedminrather than lumping them together19:28
jintyOk, then a matter of coding style?19:28
mgedminOTOH if you have a bunch of very short and similair classes, what you wrote is perfectly acceptable19:29
mgedminthere's also a useful function called verifyObject19:29
mgedminfrom zope.interface.verify import verifyObject19:29
mgedminthen you can check if an object implements the interface19:29
mgedmin  verifyObject(constraints.Constraint(), IConstraint)19:30
jintythanks, I will have a look at it...19:30
mgedminthis will catch simple errors like forgetting an argument or misspelling a method name19:30
jintyOk, important too...19:30
jintyany other points that I seem to be missing?19:31
mgedminno, I don't think so19:32
jintyThanks for the comments. At least I know I understand correctly.19:34
mgedminno problem19:35
jintyAlso a little bit about organization, do you know if anyone is working on writing wrappers for open source timetablers? (tablix, FET)19:35
mgedminTom Hoffman would know, but he's not here now19:39
mgedminI haven't heard about anything of that sort19:39
jintyOk, no worries, I'll send him a mail.19:39
jintyBut 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 ( has joined #schooltool22:57
BradBI'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
mgedminI'm not sure23:00
mgedminI think it does, but I don't really remember23:00
mgedminhave you tried using Martijn's lxml?23:01
BradBNo, it suffers that same problems I'm trying to code around now.23:01
BradBi.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
BradBIt 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 shrugs23:04
mgedminwe usually register an error handler that ignores everything23:04
BradBah :)23:04
mgedminor prints the error to a log file23:04
mgedminin most cases it is not interesting23:04
mgedminI have seen comprehensive error messages in our unit tests 23:05
mgedminwhich use libxml2.createPushParser23:05
mgedminlook at normalize_xml23:05
mgedminin schooltool.tests.helper23:05
mgedminin schooltool.tests.helpers23:05
*BradB looks23:09
BradBHm, it returns "PARSE ERROR: 76" with the XML: <?xml version="1.0" encoding="UTF-8" ?>\n<fo xmlns="http://foo"></foo> :)23:13
-->th1a ( has joined #schooltool23:13
mgedmincomprehensive == long (it copies the full input stream)23:24
mgedminit was a while since I last saw that message23:24
-->coastGNU ( has joined #schooltool23:24
BradBmgedmin: Sorry, to clarify, the only thing it actually returns is "PARSE ERROR: 76" :)23:26
mgedminah, so the rest was added by me explicitly23:29
mgedminsorry for making you chase clouds23:29
BradBno! the "with the XML: ..." was me saying "here's the XML I tested it with." :)23:31
th1amgedmin:  is there supposed to be a file at src/schooltool/translations/schooltool.pot ?23:44
coastGNUmgedmin: Any idea wher to find the pot file, can't see it via viewcws23:44
mgedminmake extract-translations23:45
mgedminthe file is automatically generated by i18nextractor23:45
mgedminthe README should mention this; it doesn't, it's a bug23:45
th1aSo you need to download the whole package and build it.23:45
coastGNUmgedmin: OK, so I have to checkout cvs first23:46
mgedminI suppose we could generate it when making a release tarball23:46
mgedminbut in general generated files are not supposed to be checked into the repository23:46
th1aOf course.23:46
th1aIt might be handy in a release.23:46
mgedmincoastGNU: I could send you the file if it would be more convenient23:46
mgedminbut it changes all the time as the set of translatable strings change23:47
coastGNUI think my bandwith shoud be big enough for download cvs (4MBit fibre)23:47
coastGNUHow do you handle CVS access for upload?23:48
mgedmincommits? we use svn+ssh23:49
coastGNUAnd do you have some kind of dictionary to ensure a consistent translation23:49
mgedminare you talking about translation into a particular language?23:50
coastGNUNever worked with subversion so far, it's a chance for further learning (c:23:50
th1aIt isn't hard.23:51
mgedminif you've worked with CVS, subversion will be a breeze23:51
coastGNULanguage, German I would suppose. Platt/Frieslaan is not as often used, even here in friesland ((c:23:51
mgedminI suppose using a consistent vocabulary would be a good idea23:54
mgedminbut we do not have any dictionaries at the time23:54
mgedminyou might have already noticed that so far we have no translations either23:55
mgedminI'm testing i18n by building a fake translation with msgfilter that encloses all translated strings in angle brackets23:55
coastGNUmgedmin: 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
th1aWhat do you mean by a dictionary?23:56
mgedmin699 strings23:56
coastGNUDictionary is a bit oversized, it's mor  a word list as used by ding23:56
th1aCan you give me an example?  Does the .pot file do this?23:57
th1aAs the Ugly American I'm ignorant of i18n...23:58
coastGNUSuch word list are used aside translation. I saw it the first time for openoffice.org23:58
mgedminas a Lithuanian I know much about i18n but almost nothing about l10n ;)23:58
coastGNUIf using tools like kbabel the more strings where translated the more help you get23:59
mgedmincoastGNU: if you're building a pot file, I suggest running svn up now23:59
coastGNUalso grut, gnome tool, grand unified translator, goes this way23:59

Generated by 2.15.1 by Marius Gedminas - find it at!