IRC log of #schooltool for Wednesday, 2011-06-01

*** menesis has joined #schooltool00:04
*** alga has quit IRC01:57
*** replaceafill has quit IRC02:16
*** fsufitch has joined #schooltool03:20
*** fsufitch has left #schooltool03:20
*** menesis has quit IRC03:28
*** aks has joined #schooltool06:13
*** alga has joined #schooltool09:32
*** aks is now known as aks_afk09:49
*** aks_afk is now known as aks10:18
*** menesis has joined #schooltool11:18
*** ignas has joined #schooltool14:07
*** menesis has quit IRC14:08
*** aks has quit IRC14:30
*** menesis has joined #schooltool14:47
*** fsufitch has joined #schooltool16:05
*** asharma_ has joined #schooltool16:57
fsufitchaelkner, ping17:05
*** replaceafill has joined #schooltool17:41
*** alga has quit IRC17:47
fsufitchreplaceafill, ping17:48
replaceafillfsufitch pong17:48
fsufitchso, remember how you told me to use __setattr__ and __getattribute_ to make the transparent courseinfo attributes?17:49
fsufitchthat doesn't work, because when the object is edited by z3c.form, it's done via an adapter or proxy of some sort, which overrides setattr and getattr itself17:50
fsufitchthe __setattr__ in CurrentCourseInfo never even gets called17:50
fsufitchso i had to do the property way17:50
fsufitch starting at line 13517:51
fsufitchit's not exactly pretty, but it works17:51
replaceafillcheck schooltool.basicperson.browser.person.PersonAddFormAdapter17:51
replaceafillbut either way is fine :)17:52
replaceafillthe important part is that you have tests for all of this17:52
fsufitchahh that17:52
fsufitchyes, i do :)17:52
fsufitchnow im off to get some food17:53
*** asharma_ has quit IRC18:23
*** asharma_ has joined #schooltool18:46
*** jelkner has joined #schooltool18:47
jelknerth1a: are you here, boss?18:48
jelknerreplaceafill, asharma_ has a question about respect18:55
jelknershe says in nepali there are different forms that show different levels of respect18:55
jelknershe is wondering how much respect we ST folks like to give people ;-)18:56
asharma_replaceafill,  in Nepali there are different ways you address people and that depends on how much respect you show them.18:57
asharma_When I was looking through the files Abhishek sent me, the degree of respect in those files are different from how I translated  the sphinx file18:58
* replaceafill is still waiting for the question...19:06
th1aasharma:  One thing to keep in mind in this process is that if there are very technical words in the SchoolTool interface or documentation that cannot be translated, it suggests that we should also be using different words in the english.19:07
th1aSo please let me know where that comes up.19:08
replaceafillis it me or is down?19:10
th1aIt is.19:10
th1aTicket filed...19:10
th1aWe need to move.19:11
fsufitchvery useful site19:16
replaceafillbookmarked :D19:16
*** replaceafill has quit IRC19:35
*** ignas has quit IRC19:38
*** aks has joined #schooltool19:45
*** replaceafill has joined #schooltool19:51
*** aks has quit IRC19:52
*** menesis has quit IRC19:55
fsufitchreplaceafill, ping19:56
replaceafillfsufitch pong19:56
fsufitchin zope, does an interface automatically adapt itself, or would i have to define an adapter for that?19:56
replaceafillyou want to adapt an interface?19:56
fsufitcher, no19:57
fsufitchi meant does it automatically adapt objects that implement that interface19:57
fsufitchICourseInfo(courseinfo), when courseinfo implements ICourseInfo19:57
replaceafillit returns the object directly19:57
fsufitchand i *don't* have to define a new adapter for that19:57
replaceafillhhmm im not sure19:58
fsufitchwell, i'll try it19:58
replaceafilli think you have to19:58
fsufitchdammit lol19:59
replaceafill:D hold on, let's find out ;)19:59
fsufitchit's an adventure!20:00
replaceafillfsufitch maybe you want ICourseInfo.providedBy(courseinfo) ?20:02
fsufitchwell... i guess that could work20:02
replaceafillin case you want to know if courseinfo provides ICourseInfo20:03
replaceafillalthough I remember yvl said we should try to avoid providedBy calls20:03
fsufitchhmm why?20:03
fsufitchsee, what i'm trying to do is to not write redundant code20:04
fsufitchand both Course and CurrentCourseInfo need to be able to have a redirect view to PublishedCourseInfo20:04
fsufitchthere are adapters for ICourse -> IPublishedCourseInfo and ICurrentCourseInfo -> IPublishedCourseInfo20:05
fsufitchso i can just adapt whatever the context is to IPublishedCourseInfo20:05
fsufitchbut if it was not able to adapt (the published course info does not exist), i need to redirect instead to a "not found" view20:05
fsufitchand i don't want to define two "not found" views20:06
fsufitchwait... i could just use the view i'm already in20:06
fsufitchjust don't redirect and just say not found instead20:06
* replaceafill thinks fsufitch needs aelkner ;)20:06
fsufitchi think aelkner has been afk :-/20:07
fsufitchbesides, it's not like i can't solve this, it's that i'm not satisfied with the elegance of that solution :)20:07
aelknerfsufitch, hey20:10
fsufitchaelkner, hi!20:10
replaceafillfsufitch check zope.interface.interface.InterfaceBasePy20:10
replaceafill__adapt__ :)20:10
replaceafill        if self.providedBy(obj):20:10
replaceafill            return obj20:10
fsufitchsweet, so it just works20:10
aelknerah, yes, adapting to oneself :)20:11
fsufitchaelkner, so, now that that is answered, design question:20:11
fsufitchi'm making a redirect view to redirect to the PublishedCourseInfo, registered for both Course and CurrentCourseInfo (so they can both have the "POS Course" button)20:12
fsufitchif the PublishedCourseInfo lookup fails, should i register a different view to tell the user "not found" and redirect to that, or just make the redirect view have a template saying "not found" that gets rendered if the redirect fails?20:12
fsufitchthe latter option requires one fewer tag in courseinfo/browser/configure.zcml :)20:13
aelkneryou don't need a POS Course for ICourse20:14
aelknerI think dwelsh agreed the user can click on Course Info first20:14
aelknerthen you can register POS Course against ICurrentCoureInfo20:14
fsufitch... oops20:14
fsufitchi failed to read the CourseInfo Tasks email properly20:14
fsufitchthe one *i* wrote20:14
aelknerbtw, i sent you an email with a couple of review comments20:15
fsufitch1) if an adapter returns none, instead of returning none on adapting, it crashes with a TypeError20:15
fsufitchit's an adapter "feature"20:15
fsufitchthat's why i use '', so i don't have to catch TypeError, since a TypeError could mean something different other than the adapter simply not finding the information20:16
aelknerno, it's better to catch the error20:18
aelknerreturning '' has no meaning20:18
fsufitchwell catching a TypeError could obscure a TypeError bug inside the adapter20:19
aelknerand as i explained, your UI should never be looking for ICourse(currentcourseinfo) if courses is empty20:19
aelkneryour view code need not have a bug that creates a CurrentCourseInfo wth no courses20:20
fsufitchit doesn't :)20:20
aelknerabout your point about catching bugs in an adapter20:20
fsufitchand actually a CurrentCourseInfo with no courses should never even make it into the database20:21
fsufitchsince "title" is required, and it needs courses to get its title20:21
aelknerso you see my point20:21
fsufitchactually now i think about it, the '' is actually a placeholder from when that restriction was *not* in place20:21
aelknerbut understand that returning None in an adapter is the same as failing witin the adapter20:21
aelknerunfortunately, zope doesn't tell you the difference20:21
fsufitch^^ that's what i was trying to solve, trying to tell the difference myself :)20:22
aelkneryou can't, so don't try :)20:22
aelkneri spent hours once trying to figure out why i couldn't adapt using one of schooltool core's adapters20:22
aelkneri saw the adpater existed, the code looked good, the registration and everything20:23
aelknerit was not until i pdb stepped that i saw that it had a bug that raised an exception20:23
aelknerwhich results in the adapter returning None, or as you say a TypeErro xception20:23
aelknerthat's just the way zope works with adpaters20:24
aelkneryou need them to be well coded and unit tested20:24
aelknerand otherwise, just trust them :)20:24
fsufitchok :)20:24
aelknerso anyway, adapting ICourse(info with no courses) should fail, so you can unit test that20:25
fsufitchwill do20:25
aelknergrep schooltool core for Exception | grep txt to see examples of testing for exceptions20:25
aelknerunless you already have done that before20:25
fsufitchwhat about for an adapter like IPublishedCourseInfo(currentcourseinfo)?20:26
fsufitchin that case it's possible that it is *not* found20:26
aelknerthat's ok, from time to time (not always because assumptions are good to make most of the time)20:27
aelkneryou can code an adapter call as follows:20:27
aelknerpublished = IPublishedCourseInfo(currentcourseinfo, None)20:27
aelknerif published is None:20:27
aelkner    ...20:27
fsufitchwait, a multiadapter?20:27
aelknerto handle that case gracefully20:27
aelkneradapting with the interface is always single adapting20:28
fsufitchoh, you can always add a final argument to adapters that works as if this was a .get() call?20:28
aelknerthe second parameter is fallback20:28
fsufitchoh wait, right20:28
fsufitchyou're right20:28
aelknerlike dictionary get20:28
fsufitchi was being silly20:28
fsufitchyay! that's the solution i was actually looking for20:28
fsufitchi didn't know that worked20:28
aelkneroh, and re: your discussion wth replaceafill regarding providedBy20:29
aelknerdefinitely don't use it20:29
aelkneryvl forbids it20:29
replaceafillfsufitch zope.interface.interface.InterfaceBasePy.__call__ ;)20:29
aelkneralso, yes adapting to oneself wrks like a charm20:29
aelknerreplaceafill has fond the code that explains why :)20:29
aelkneryou can also take ones word for t like i did with yvl :)20:30
aelknerregarding the second point in my email20:31
aelknerdo you see what i meant20:31
fsufitchwhen i pass course_id in the url, i should just be passing the name20:31
fsufitchthough, by default, course_id == __name__20:32
fsufitchthat's why i got confused20:32
aelkneryou can call it name in the view code20:32
aelknerit's clear enough20:32
fsufitchoh, and i forgot to utest new adapters, i need to do that20:33
aelknergood thinking20:33
fsufitchoh, and btw, i talked to dwelsh, and since none of the attributes of courseinfo are required anymore, he prefers i remove the add view altogether, and have courseinfo objects auto-vivify themselves upon adapting the ICourse20:34
fsufitchand clicking the "Course Info" button just leads to the display view20:35
aelkneran empty display view?!20:35
fsufitchsince the only required attributes are course_id, and title, both of which can be grabbed from the originating course20:35
fsufitchwell, why not?20:35
aelkneryeah, as i think about it, it seems ok20:36
aelknerand dwelsh already signed off on it, so ...20:36
fsufitchmakes it less confusing for the user too, since having both "add" and "edit" terms for something that is essentially an extension on Course can be confusing20:36
fsufitchor so dwelsh said20:36
aelknerhe has a point20:36
aelknerand these usability issues are top priority20:37
fsufitchso, i guess i'm just going to code auto-vivification in the ICourse -> ICurrentCourseInfo adapter20:37
th1aaelkner:  I'm writing this script for dwelsh.20:42
th1aI just need the url pattern for finding the report he needs if I have the section, year, etc.20:42
aelknerth1a, ok, looking...20:43
aelknerfsufitch, i imagine you gathered that by making this auto-vivify assumption, you make the code a lot safer20:47
fsufitchaelkner, yup20:47
aelknersince the adapter always will set up the call to add(course)20:47
fsufitchand CurrentCourseInfo can't be created any other way20:47
aelknerth1a, fsufitch how does the user request this cando report again?20:47
aelkneri can't even find any rml files in cando20:48
fsufitcher... i'm not sure which report you're talking about20:48
th1aThe section archive ones.20:48
th1aSHould I be asking replaceafill about this?20:48
th1aWas this a replaceafill project?20:48
aelknerso from ISection, 'Archive' ?20:48
replaceafillth1a what report do you need?20:49
th1aThe question is what dwelsh needs.20:49
aelknerreplaceafill, how to request the section archive20:49
aelknerth1a is righting a loop script for all sections20:49
aelknerand need to request the archive for each section20:49
aelknerrighting, duh, writing20:50
* replaceafill looks...20:50
fsufitchcompetency gradebook should have a "VA Section Report"  button, according to configure.zcml20:50
aelknertrying to type fast enough to simulate speech speed leads to many typing mistakes20:50
fsufitchit's sectionreport.html20:50
aelknerthat would be it20:50
aelknerno rml template?20:50
fsufitchsectionreport.html for the competency gradebook20:50
aelkneris this not a pdf?20:51
* fsufitch shrugs20:51
fsufitchi'm just saying what's in the configure :)20:51
fsufitchno, the only pdfs are student report, and student certificate20:51
fsufitch*student competency record20:51
th1aOK, I'll double check with dwelsh.20:52
fsufitchbecause this is definitely a HTML report20:52
replaceafillif it's the section archive what you want you need "src_archive"20:52
aelknernot necessary, i think VA Section Report sounds like the right link20:52
th1aThis is something people are downloading, so I'm confused about it being html.20:53
fsufitchgradebook/scr_archive exists20:53
replaceafillth1a it's a pdf20:53
th1ascr_archive is?20:53
fsufitchshould be scr_archive.pdf :)20:54
fsufitchthere is no link to it from the UI apparently?20:54
replaceafillth1a yes20:54
fsufitchunless it's in a template or something20:54
th1aso, ...section/scr_archive ?20:54
fsufitchit's on the gradebook, not on the section20:55
fsufitchand wait, there is an interface link to it20:55
aelknerfsufitch, you beat me to it :)20:56
fsufitchgrep powah :D20:56
replaceafillnah! i wanted the user typing the full url... ¬¬20:56
th1aBasically I'm getting all the necessary id's from the .xls export.20:56
aelknerreplaceafill, why scr_archive with no .html after it?20:57
replaceafillbecause it returns a pdf...20:58
fsufitchwhy no .pdf after it? :)20:58
aelknerit should have .pdf then20:58
replaceafillrun it and you'll see :)20:58
replaceafillaelkner it generates a name for the pdf20:58
fsufitch@property filename20:58
fsufitchthat's neat20:59
replaceafillwait what!!!! no pdf!!!20:59
fsufitchnote to self: use that other times20:59
fsufitchthe way i solved that problem in pybookbuilder before was by20:59
th1aSo... do I need the .pdf in the url?20:59
fsufitchwhen the user needed to download a file at some/path/here, i would redirect them to some/path/here/thefile.png or whatever, to make sure they had the filename21:00
fsufitchno, no pdf in url21:00
replaceafillth1a you visit the url and you'll get a pdf with a generated name21:00
replaceafillfor download21:00
replaceafillreturn "%s_%s_%s_%s.pdf" % (sy, state_course_code, local_course_code, section.__name__)21:01
replaceafillthe use case there was that dwelsh wanted to be able to visit many sections and save their individual pdfs21:02
th1aWhat's up with all the codes?21:03
replaceafill:) so dwelsh can tell every pdf apart21:04
th1aOK, someone has to give me a full description of what I have to do to generate the right url.21:04
replaceafill2010-2011__6670_1.pdf -> school year, no state course code, local: 6670, section id: 121:04
replaceafillth1a just to to the section21:04
th1aOh, that's bullshit.21:05
replaceafilland add '/gradeCompetencies/scr_archive21:05
aelknerth1a, what do you have in a variable during your loop?21:05
aelknerthe section traversal?21:05
aelknerif so, just add what replaceafill just said21:05
th1aI was assuming that year, term, course, section, ID's would do it.21:05
replaceafillyou can use those to build the url, can't you?21:06
aelknerthe section knows all that, so all you need to the gradeCompetencies traversal adapter and then the view21:06
th1anobody is explaining this to me in an understandable way.21:06
th1aI don't have the state course code.21:06
aelkneranswer my first question, then i'll explain21:07
aelkneryou have a loop, right21:07
replaceafillth1a you dont need that!!!21:07
th1aI don't have anything except those id's.21:07
th1aI mean, I could take a completely different approach.21:07
* replaceafill thinks only one of us should explain this to th1a21:07
th1aI'm just trying to generate urls from id's.21:07
th1aIf I can't do that, I have to start over.21:07
aelkneri see, you generated a list of ids by visiting container views?21:07
th1aI'm using the xls export.21:08
aelkneri agree you should be able to get this done from the ids21:08
aelkneryou have year id, term id, section id, right?21:08
aelkneri beleive that gets you to the section, don't hold me to it unless i grok the config again21:09
th1aBut do I have to generate this crazy filename then?21:10
aelkneryou add /gradeCompetencies/scr_archive21:10
th1aI guess that I can do some kind of mechanized browser session to grab the right link.21:10
aelknerthe whole thing (sorry) should be:21:11
replaceafillth1a can i speak? :)21:11
th1aI didn't tell you to be quiet.21:11
replaceafillok thanks :)21:11
aelkneryeah, who's stopping you21:12
replaceafillaelkner you :)21:12
th1aOK boys.21:12
replaceafillth1a if you visit a url like that ^21:12
aelknerspeak up, my good man!21:12
replaceafillyou'll get a download dialog to save the file, right?21:12
replaceafilli have no idea about what you're doing btw21:13
th1aI was just going to be using httplib21:13
replaceafillyou can do that21:13
replaceafilljust check the headers of the respoonse21:13
th1aI wasn't going to do any simulated browsing at all.21:13
aelknerso httplib allows you to save the response as a file?21:14
replaceafilli'd use urllib21:14
aelknerwith a simple call or something?21:14
replaceafillurllib2 to be precise21:14
replaceafilland check for Content-Disposition21:15
aelknerth1a, is that what you're using?21:15
th1aI haven't gotten that far yet.21:15
replaceafillthat header should bring a "filename=..." part21:15
th1aI didn't know the url!21:15
th1aBut yes, probaby urllib221:15
replaceafillok, clear as mud then?21:16
aelknerso replaceafill, the above url would be correct, right?21:16
th1aI'll need to do basic auth?21:16
aelkneryeah, that's the rub21:17
aelknerhow does one do that?21:17
th1aIt seems to be in urllib2.21:17
replaceafillth1a i think you need to handle the session21:17
replaceafillyou can authenticate building the url, http://localhost/auth/login.html?username=foo&password=bar, but you need to save the cookie for future requests21:18
th1aI don't HAVE TO, right?21:19
replaceafillth1a why don't you go selenium :P21:19
replaceafillah! you have to give this to somebody else (dwelsh) :)21:19
th1aEnd users have to be able to do this.21:19
th1aNot just him.21:19
th1aThe other users.21:19
replaceafillright, then python can do it21:20
replaceafillaelkner "speak up, my good man!" lol21:22
aelkneri wasn't wanting to speak :))))21:24
aelkneri'm just listening because i would have more questions than answers21:24
aelkneranother question, how to get the password from the user at the command line without it appearing in the command session21:25
th1aCan I include the auth data just when requesting the pdf?21:25
replaceafillth1a i think you'd be redirected to the auth form21:25
aelkneruserid should be a secret, too21:25
th1aaelkner:  That's not a requirement as far as I'm concerned.21:25
th1aSo I do need to keep the cookie then... hm.21:26
th1aMaybe I can just use mechanize then.21:26
replaceafillaelkner, can't you just include USER='' and PASSWORD='' in the script?21:26
replaceafilland make the user to write the right credentials21:26
replaceafillbefore running the script21:26
aelkneryou mean, the user edits the script to fill in those values?21:27
aelknerand only the user can see that file?21:27
aelknerthat could work21:27
* replaceafill goes to lunch21:31
* th1a goes to lie down.21:32
fsufitchaelkner, ping21:36
fsufitchnevermind, figured it out :)21:42
fsufitchaelkner, so, course_id appears to be not required in schooltool.course.interfaces, so as part of your point number 2) i'm making it not required for courseinfo either21:47
fsufitchso it appears that title is the only required attr, and that one is transparent to Course21:47
fsufitchauto-vivification committed, along with the fixes you wanted :)21:54
fsufitchnext task: unit test overhaul to match the new adapters22:00
fsufitchbut no time today, i have to go to class22:00
*** menesis has joined #schooltool22:05
replaceafillmenesis do you have the versions.cfg files in launchpad?22:06 is down :(22:06
replaceafilland buildout fails22:06
*** fsufitch has quit IRC22:08
menesisreplaceafill: yes, versions.cfg files are in project22:10
replaceafillexcellent, thanks!22:10
*** menesis has left #schooltool22:11
*** menesis has joined #schooltool22:11
menesisdownload versions.cfg and edit buildout.cfg, change extends line to22:12
menesisextends = versions.cfg22:12
menesisdownloads are also on
replaceafilli hope my eggs cache works ;)22:14
menesishave to use all branches22:14
menesisyes buildout cache helps in this situation22:15
menesisif you have a line in ~/.buildout/default.cfg22:16
menesisextends-cache = /home/menesis/.buildout/extends22:16
menesisthen the files that are extended are also cached22:16
replaceafillah, btw, cando's Makefile has an incorrect rule22:17
replaceafillbuild: bin/test22:18
replaceafillshould be:22:18
replaceafillbuild: .installed.cfg22:18
replaceafillor you get:22:18
replaceafillmake: *** No hay ninguna regla para construir el objetivo `bin/test', necesario para `build'.  Alto.22:18
menesisbuildout works for me from the cache. if not, can try -N or -o (offline) flags22:18
* replaceafill hopes menesis' spanish is great22:18
replaceafillyes, the cache also works here :)22:19
menesisthere is an error while updating schooltool docs part22:19
menesishave to comment out default.css line in buildout.cfg22:20
replaceafillcando still doesnt have 'docs' :)22:20
menesisyes but I tried another random branch22:21
menesisall makefiles earlier had build: bin/test line22:21
menesisbut buildbot sometimes failed22:21
menesisso I used .installed.cfg as a build stamp22:22
menesishaven't built cando in a while22:22
menesisbut of course now that is down everything may have problems22:23
*** asharma_ has quit IRC22:23
menesisdon't know what else can I do now22:28
menesiswaiting for an answer from admin who has access to the server22:29
menesishope its hard drive is not totally broken22:30
replaceafillcando + schooltool_trunk break cando's skin22:37
replaceafillbecause of the removal of ++resource++bugs.gif22:37
*** alga has joined #schooltool22:40
menesisI have uploaded the Book to
menesisalso, finally, uploaded developers documentation to :)22:50
*** jelkner has quit IRC23:03
*** jelkner has joined #schooltool23:05

Generated by 2.15.1 by Marius Gedminas - find it at!