Saturday, 2014-02-22

*** tpb has joined #melange00:00
shikhermadrazr: How come GSoCProgram is a different Entity than GCIProgram when I look at local datastore? I see only one program model in the code.00:04
nathanielmanistaDo you not see soc.models.program.Program, soc.modules.gci.models.program.GCIProgram, and soc.modules.gsoc.models.program.GSoCProgram?00:07
shikhernathanielmanista: thanks.00:17
nathanielmanistaYeah, I found it confusing when I joined the project too.00:36
*** monkegjinni has joined #melange00:58
*** monkegjinni has quit IRC01:03
*** asmeurer has joined #melange01:43
*** robbyoconnor has joined #melange02:26
*** asmeurer has quit IRC02:34
*** jasvir has joined #melange02:42
jasvirmadrazr: Hello madrazr . Can we discuss it now?02:42
madrazrjasvir: sure02:59
*** monkegjinni has joined #melange02:59
jasvirmadrazr: Should I repeat my query?03:00
madrazrjasvir: please?03:01
jasvirmadrazr: I am looking at soc/templates/modules/gsoc/base.html and found something like {{ header.render }}, {{ mainmenu.ender }}. I am not able to understand tha what is the source of these mainmenu, header. Please help me to find :)03:03
jasvirmadrazr: mainmenu.render*03:04
*** monkegjinni has quit IRC03:04
madrazrjasvir: what exact source are you looking for?03:05
madrazrjasvir: Python source?03:05
madrazrjasvir: also have you tried using grep to search in the source code?03:05
jasvirmadrazr: Is there any other source?03:05
madrazrjasvir: yes03:05
madrazrthere is the Python part03:06
madrazrand then the HTML part, along with CSS03:06
jasvirmadrazr: I have not used grep :(03:06
madrazrjasvir: please do, as an exercise03:06
madrazrjasvir: I will be here to help03:06
jasvirmadrazr: Ok. I'll do it now :)03:06
madrazrjasvir: I can tell you the exact locations/paths in the source code right away03:07
madrazrbut what fun would it be if I you don't try :)03:07
madrazras in, if I don't let you try and learn things03:07
jasvirmadrazr: python source: soc/modules/gsoc/views/base_templates.py03:21
jasvirmadrazr: html source: soc/templates/modules/gsoc/mainmenu.html03:22
madrazrjasvir: perfect03:26
jasvirmadrazr: In base_template, first they have created a context with about_link, connect_link etc in siteMenuContext. Then they add some more links in this context in MainMenu.03:26
madrazrthose are for GSoC though03:26
madrazrthere are GCI-equivalents03:26
madrazrand the base classes03:26
madrazrjasvir: correct03:27
jasvirmadrazr: I was looking in GSoC module first.03:27
madrazrjasvir: sure03:27
jasvirmadrazr: But how base.html file will came to know, from where to get value of mainmenu?03:31
madrazrjasvir: I am not sure if I understand the question correctly. Can you elaborate a bit?03:32
*** robbyoconnor has quit IRC03:33
jasvirmadrazr: See. In gsoc/base.html file. They have {{ mainmenu.render }}. Does it mean, render mainmenu.html file placed in same folder?03:35
jasvirmadrazr: or something else?03:35
madrazrjasvir: Ah, I see your point. We have several base.html files, pretty much one in every template folder if you go and check03:36
madrazrit is always better to be explicit with the paths when you mention a file03:36
madrazrjasvir: otherwise it becomes quite ambiguous03:36
jasvirmadrazr: Yeah. I just forget it this time.03:36
madrazrjasvir: so do you know how Django views and templates work?03:37
jasvirmadrazr: The level upto which I have worked on django views and templates, we create a list of variables or objects and pass it to template. Then in template, we just render it uisng for loop like, {% for values in list %} ... {{ value }}.03:39
madrazrjasvir: exactly03:40
jasvirmadrazr: {{ values* }}03:40
madrazrthat's good enough for now03:40
madrazrso you almost know the answer for your question now03:40
madrazrto make it a bit more concrete03:40
madrazrapp/soc/templates/modules/gsoc/base.html is a base template in our GSoC system03:41
madrazrindividual pages on the site are rendered by their own template files and most of the GSoC page specific html template files inherit from  app/soc/templates/modules/gsoc/base.html03:42
madrazron the Python side03:42
madrazrsimilarly almost all the views in GSoC inherit from GSoCRequestHandler03:42
madrazrin app/soc/modules/gsoc/views/base.py03:43
madrazroops, instead of just app/soc/modules/gsoc/views/base.py if you see any view in GSoC they take renderer as an argument in the constructor of the view class03:48
madrazrand every time a view class instance is constructed we supply this renderer as an argument03:48
jasvirmadrazr: didn't get you from "on the python side"03:48
madrazrwhat part did you not get?03:49
madrazrnone of it?03:49
jasvirmadrazr: got your messages just now, due to some lag. Looking into them now.03:50
madrazrjasvir: Ok03:51
madrazrjasvir: so just to complete what I was saying03:51
madrazrjasvir: a renderer must be passed as an argument to the view class while constructing the object03:51
madrazrjasvir: that renderer for GSoC is SOCRenderer in ./summerofcode/request/render.py03:53
madrazrwhich defines the render() method and defines what mainmenu, header, footer etc variables are all for the view context03:53
madrazrand since this is passed to every GSoC view class as part of the constructor03:53
madrazrevery view knows about mainmenu, header, footer etc03:54
madrazrand they just pass it to their templates03:54
madrazrand hence the templates can call {{ mainmenu.render }}, {{ header.render }} etc03:54
madrazrjasvir: as clear as mud?03:54
madrazrjasvir: I know this is too complicated03:54
madrazrjasvir: too many layers of abstraction and composition here03:54
madrazrjasvir: keep asking questions until you get them03:55
jasvirmadrazr: WOW!!03:55
jasvirmadrazr: Got it now.03:55
madrazrjasvir: cool!03:55
jasvirmadrazr: Let me make a picture. I'll ask you if there is any black spot :)03:56
*** vijay13 has joined #melange03:59
jasvirmadrazr: Now picture is like this.04:00
madrazrjasvir: sure04:02
jasvirmadrazr: modules/gsoc/views/homepage.py imports base, base import summerofcode/render, render import gsoc/views/base_templates. Now base_templates knows what mainmenu is. So finally, homepage also know, what mainmenu is and it tells base.html that about it. Now mainmenu.render means render the mainmenu.html and append it in place of {{ mainmenu.render }}.04:07
jasvirmadrazr: Correction04:08
jasvirmadrazr: Picture is still not clear. {{ mainmenu.render }} is call to function render, which in return call base_templates.MainMenu ?04:14
madrazrjasvir:04:20
madrazrmainmenu is an instance of MainMenu class04:20
madrazr{{ mainmenu.render }} calls the render() method of the MainMenu class04:21
jasvirmadrazr: thats what i said.04:22
madrazrjasvir: is it?04:22
madrazrOk04:22
jasvirmadrazr: Yes. I'll ask you if there is any other problem :)04:24
madrazrjasvir: sure04:27
*** ashishk has joined #melange04:47
ashishkmadrazr: hi04:50
madrazrashishk: Hi04:50
ashishkmadrazr: i have written a test case in ./soc/tests/app/soc/modules/gsoc/views/test_proposal.py ,but i don't know how to check whether it is correct or not ??04:51
madrazrashishk: run the tests :)04:51
madrazr./bin/run-tests04:51
madrazrashishk: to debug your specific test file run04:52
madrazr$ ./bin/run-tests -t pyunit /path/to/your/test/file04:52
ashishkmadrazr: thanks04:56
madrazrashishk: np04:56
ashishkmadrazr: did u find the solution for that html rendering in exception?04:56
*** monkegjinni has joined #melange05:00
*** monkegjinni has quit IRC05:05
madrazrashishk: not yet05:10
ashishkmadrazr: ok,please tell me when you are done with that :)05:13
madrazrashishk: done? ;-)05:14
ashishkmadrazr: sorry , :)05:15
madrazrashishk: just kidding05:16
madrazrashishk: don't worry, I will let you know if I find out by before going to bed today05:16
madrazrashishk: if I don't, please do nag me tomorrow sometime. Just in case, to make sure I haven't forgotten05:16
ashishkmadrazr:yeah sure,i have run the test case it shows  OK05:16
madrazrashishk: cool!05:16
ashishkmadrazr: one more help,i was going throug issue 2030 http://code.google.com/p/soc/issues/detail?id=2030,i did not understand what daniel means about org_app is not set??05:18
madrazrashishk: have you looked at the view code that renders the list for which the error you reported appears?05:25
madrazri.e. for the manage organizations view?05:25
ashishki think view for this page is here soc/app/summerofcode/views/org_app.py05:27
ashishkmadrazr: in this page there is a class OrgApplicationList in which i need to change ,am i right ??05:28
madrazrashishk: https://code.google.com/p/soc/source/browse/app/summerofcode/views/org_app.py#106405:28
madrazrlook at that code05:28
tpb<http://ln-s.net/B4Xh> (at code.google.com)05:28
madrazrashishk: yes05:28
madrazrashishk: that line is trying to access data.org_app unguarded05:29
madrazrashishk: what happens if org_app does not exist?05:29
madrazrsince it is unguarded05:29
madrazrashishk: what happens is the error you see05:29
madrazrashishk: now, in order to avoid this bad thing from happening, Daniel suggests05:30
madrazroops, suggests 2 things05:30
madrazrashishk: 1. The code should not even get up to this point if the user directly hits this URL05:30
madrazr2. There should be no UI side affordance for any user to get to this page at all when the org_app does not exist05:31
madrazrSolution for 1. is, see a few lines above05:31
madrazraccess_checker = access.PROGRAM_ADMINISTRATOR_ACCESS_CHECKER05:31
madrazrthe current access_checker only checks if the user is a program admin05:32
madrazrwhat he says is, in addition to that, it should also check if the org app exists05:32
madrazrand if not it should raise an access violation05:32
madrazrThe solution for 2. is in admin.py05:33
madrazrhttps://code.google.com/p/soc/source/browse/app/soc/modules/gsoc/views/admin.py#37605:33
tpb<http://ln-s.net/B4Xu> (at code.google.com)05:33
madrazrthis should be conditionally added only if org app exists05:34
ashishkmadrazr: oh,so for 2. i need to check if org_app exists then add this page otherwise don't05:35
madrazrashishk: correct05:35
madrazryou need to do both to fix this problem05:35
ashishkmadrazr: thanks ,i will check both  :)05:35
madrazrashishk: great!05:35
madrazrwith that, I need to get going. Not a good thing to be in office at 9:30 after Friday :P05:36
madrazr*9:30PM on Friday05:36
*** madrazr has quit IRC05:36
*** vijay13 has quit IRC05:42
*** RoonyH has joined #melange05:47
*** vijay13 has joined #melange05:56
*** RoonyH has quit IRC06:22
*** asmeurer has joined #melange06:35
*** asmeurer has quit IRC06:40
*** RoonyH has joined #melange06:41
*** ashishk has quit IRC07:17
*** vivekjain has joined #melange07:51
*** RoonyH has quit IRC07:52
*** vivekjain has quit IRC07:57
*** vivekjain has joined #melange08:10
*** vivekjain has quit IRC08:53
*** vijay13 has quit IRC08:57
*** jasvir has left #melange08:58
*** ashishk has joined #melange09:00
*** vijay13 has joined #melange09:10
*** madrazr has joined #melange09:15
*** ChanServ sets mode: +o madrazr09:15
*** vijay13 has quit IRC09:15
ashishkmadrazr: hi,regarding our previous talk on issue 2030 ,how do i check whether an org_app exists or not because if i am doing like this if data.org_app: print 'yes' else: print 'no',it always print yes because i have a value in my orgappsurvey09:23
ashishkthe value in orgappsurvey comes when i do seed_db09:23
ashishkmadrazr: also i found somewhere data.org_app_record?? what does it mean ??09:26
madrazrif there is no org application, data.org_app will be None09:27
madrazrashishk: try setting up a new local instance09:27
madrazrand experiment09:27
madrazrashishk: ideally what you should be doing is09:27
madrazrto write a test case first09:28
madrazrthen that test case would fail now because the code does the wrong thing09:28
madrazrand then that also serves as your path for debugging09:28
madrazrthen you go ahead and fix the code, using your test to debug09:28
madrazrand then after the code is fixed, the test should pass09:29
*** vivekjain has joined #melange09:29
ashishkmadrazr: okay ,i will try using test case :)09:31
ashishkmadrazr: if i find some other problem i'll ask you :)09:32
madrazrashishk: sure09:32
*** madrazr has quit IRC09:51
*** madrazr has joined #melange09:51
*** ChanServ sets mode: +o madrazr09:51
*** ashishk has quit IRC10:32
*** ashishk has joined #melange10:41
*** shikher has quit IRC10:41
ashishkmadrazr: i think there is already test case for the gsoc/org/application/list/google/gsoc2014 here soc/tests/app/summerofcode/views/test_org_app.py right ??10:44
ashishkmadrazr: but when i run ./bin/run-tests -t pyunit ./tests/app/summerofcode/views/test_org_app.py it run successfully .while it should not because there is an error on gsoc/org/application/list/google/gsoc2014.10:47
*** madrazr has quit IRC10:54
*** ashishk has quit IRC10:55
*** rocker_ has joined #melange11:24
*** jasvir has joined #melange11:27
*** rocker_ has quit IRC11:37
*** vivekjain has quit IRC11:51
*** vivekjain has joined #melange11:57
*** Niharika has joined #melange12:28
*** RaulT has joined #melange12:59
*** jasvir has quit IRC13:01
*** jasvir has joined #melange13:03
*** run009 has joined #melange13:30
*** run009 is now known as ashishk13:30
*** RoonyH has joined #melange13:39
*** ashishk has quit IRC13:42
*** ashishk has joined #melange13:42
*** rocker_ has joined #melange13:52
*** suranga_ has quit IRC13:55
*** RoonyH has quit IRC13:56
*** larryxiao has joined #melange14:06
*** jasvir has left #melange14:20
*** cosenal has quit IRC14:31
*** larryxiao has quit IRC14:31
*** parx has quit IRC14:31
*** mwilkes|away has quit IRC14:31
*** harlan has quit IRC14:31
*** downey has quit IRC14:31
*** nathanielmanista has quit IRC14:31
*** Lennie has quit IRC14:31
*** olly has quit IRC14:31
*** rocker_ has quit IRC14:31
*** gsocbot has quit IRC14:31
*** hjpotter92 has quit IRC14:31
*** Niharika has quit IRC14:31
*** Mek has quit IRC14:31
*** kblin has quit IRC14:31
*** scorche` has quit IRC14:31
*** gevaerts has quit IRC14:31
*** clopez has quit IRC14:31
*** Darrel has quit IRC14:31
*** scorche|sh has quit IRC14:31
*** schultmc_ has quit IRC14:31
*** bytee_ has quit IRC14:31
*** antrik has quit IRC14:31
*** Triskelios has quit IRC14:31
*** trout has quit IRC14:31
*** buildbot_beta has quit IRC14:31
*** schultmc has quit IRC14:31
*** dag10|away has quit IRC14:31
*** RaulT has quit IRC14:31
*** vivekjain has quit IRC14:31
*** ggherdov has quit IRC14:31
*** ashishk has quit IRC14:31
*** Mek has joined #melange14:37
*** ashishk has joined #melange14:37
*** RaulT has joined #melange14:37
*** vivekjain has joined #melange14:37
*** Darrel has joined #melange14:37
*** scorche` has joined #melange14:37
*** gevaerts has joined #melange14:37
*** dag10|away has joined #melange14:37
*** schultmc has joined #melange14:37
*** kblin has joined #melange14:37
*** clopez has joined #melange14:37
*** buildbot_beta has joined #melange14:37
*** trout has joined #melange14:37
*** Triskelios has joined #melange14:37
*** bytee_ has joined #melange14:37
*** schultmc_ has joined #melange14:37
*** ggherdov has joined #melange14:37
*** scorche|sh has joined #melange14:37
*** antrik has joined #melange14:37
*** Lennie has joined #melange14:37
*** nathanielmanista has joined #melange14:37
*** downey has joined #melange14:37
*** olly has joined #melange14:37
*** harlan has joined #melange14:37
*** mwilkes|away has joined #melange14:37
*** asimov.freenode.net sets mode: +oo Lennie nathanielmanista14:37
*** Niharika has joined #melange14:39
*** kblin has quit IRC14:41
*** suranga_ has joined #melange14:48
*** Darrel has quit IRC14:49
*** scorche|sh has quit IRC14:49
*** schultmc_ has quit IRC14:49
*** bytee_ has quit IRC14:49
*** schultmc_ has joined #melange14:49
*** vivekjain has quit IRC14:51
*** scorche|sh has joined #melange14:51
*** kblin has joined #melange14:53
*** kblin has joined #melange14:53

Generated by irclog2html.py 2.12.1 by Marius Gedminas - find it at mg.pov.lt!