*** tpb has joined #melange | 00:00 | |
shikher | madrazr: 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 |
---|---|---|
nathanielmanista | Do you not see soc.models.program.Program, soc.modules.gci.models.program.GCIProgram, and soc.modules.gsoc.models.program.GSoCProgram? | 00:07 |
shikher | nathanielmanista: thanks. | 00:17 |
nathanielmanista | Yeah, I found it confusing when I joined the project too. | 00:36 |
*** monkegjinni has joined #melange | 00:58 | |
*** monkegjinni has quit IRC | 01:03 | |
*** asmeurer has joined #melange | 01:43 | |
*** robbyoconnor has joined #melange | 02:26 | |
*** asmeurer has quit IRC | 02:34 | |
*** jasvir has joined #melange | 02:42 | |
jasvir | madrazr: Hello madrazr . Can we discuss it now? | 02:42 |
madrazr | jasvir: sure | 02:59 |
*** monkegjinni has joined #melange | 02:59 | |
jasvir | madrazr: Should I repeat my query? | 03:00 |
madrazr | jasvir: please? | 03:01 |
jasvir | madrazr: 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 |
jasvir | madrazr: mainmenu.render* | 03:04 |
*** monkegjinni has quit IRC | 03:04 | |
madrazr | jasvir: what exact source are you looking for? | 03:05 |
madrazr | jasvir: Python source? | 03:05 |
madrazr | jasvir: also have you tried using grep to search in the source code? | 03:05 |
jasvir | madrazr: Is there any other source? | 03:05 |
madrazr | jasvir: yes | 03:05 |
madrazr | there is the Python part | 03:06 |
madrazr | and then the HTML part, along with CSS | 03:06 |
jasvir | madrazr: I have not used grep :( | 03:06 |
madrazr | jasvir: please do, as an exercise | 03:06 |
madrazr | jasvir: I will be here to help | 03:06 |
jasvir | madrazr: Ok. I'll do it now :) | 03:06 |
madrazr | jasvir: I can tell you the exact locations/paths in the source code right away | 03:07 |
madrazr | but what fun would it be if I you don't try :) | 03:07 |
madrazr | as in, if I don't let you try and learn things | 03:07 |
jasvir | madrazr: python source: soc/modules/gsoc/views/base_templates.py | 03:21 |
jasvir | madrazr: html source: soc/templates/modules/gsoc/mainmenu.html | 03:22 |
madrazr | jasvir: perfect | 03:26 |
jasvir | madrazr: 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 |
madrazr | those are for GSoC though | 03:26 |
madrazr | there are GCI-equivalents | 03:26 |
madrazr | and the base classes | 03:26 |
madrazr | jasvir: correct | 03:27 |
jasvir | madrazr: I was looking in GSoC module first. | 03:27 |
madrazr | jasvir: sure | 03:27 |
jasvir | madrazr: But how base.html file will came to know, from where to get value of mainmenu? | 03:31 |
madrazr | jasvir: I am not sure if I understand the question correctly. Can you elaborate a bit? | 03:32 |
*** robbyoconnor has quit IRC | 03:33 | |
jasvir | madrazr: See. In gsoc/base.html file. They have {{ mainmenu.render }}. Does it mean, render mainmenu.html file placed in same folder? | 03:35 |
jasvir | madrazr: or something else? | 03:35 |
madrazr | jasvir: Ah, I see your point. We have several base.html files, pretty much one in every template folder if you go and check | 03:36 |
madrazr | it is always better to be explicit with the paths when you mention a file | 03:36 |
madrazr | jasvir: otherwise it becomes quite ambiguous | 03:36 |
jasvir | madrazr: Yeah. I just forget it this time. | 03:36 |
madrazr | jasvir: so do you know how Django views and templates work? | 03:37 |
jasvir | madrazr: 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 |
madrazr | jasvir: exactly | 03:40 |
jasvir | madrazr: {{ values* }} | 03:40 |
madrazr | that's good enough for now | 03:40 |
madrazr | so you almost know the answer for your question now | 03:40 |
madrazr | to make it a bit more concrete | 03:40 |
madrazr | app/soc/templates/modules/gsoc/base.html is a base template in our GSoC system | 03:41 |
madrazr | individual 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.html | 03:42 |
madrazr | on the Python side | 03:42 |
madrazr | similarly almost all the views in GSoC inherit from GSoCRequestHandler | 03:42 |
madrazr | in app/soc/modules/gsoc/views/base.py | 03:43 |
madrazr | oops, 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 class | 03:48 |
madrazr | and every time a view class instance is constructed we supply this renderer as an argument | 03:48 |
jasvir | madrazr: didn't get you from "on the python side" | 03:48 |
madrazr | what part did you not get? | 03:49 |
madrazr | none of it? | 03:49 |
jasvir | madrazr: got your messages just now, due to some lag. Looking into them now. | 03:50 |
madrazr | jasvir: Ok | 03:51 |
madrazr | jasvir: so just to complete what I was saying | 03:51 |
madrazr | jasvir: a renderer must be passed as an argument to the view class while constructing the object | 03:51 |
madrazr | jasvir: that renderer for GSoC is SOCRenderer in ./summerofcode/request/render.py | 03:53 |
madrazr | which defines the render() method and defines what mainmenu, header, footer etc variables are all for the view context | 03:53 |
madrazr | and since this is passed to every GSoC view class as part of the constructor | 03:53 |
madrazr | every view knows about mainmenu, header, footer etc | 03:54 |
madrazr | and they just pass it to their templates | 03:54 |
madrazr | and hence the templates can call {{ mainmenu.render }}, {{ header.render }} etc | 03:54 |
madrazr | jasvir: as clear as mud? | 03:54 |
madrazr | jasvir: I know this is too complicated | 03:54 |
madrazr | jasvir: too many layers of abstraction and composition here | 03:54 |
madrazr | jasvir: keep asking questions until you get them | 03:55 |
jasvir | madrazr: WOW!! | 03:55 |
jasvir | madrazr: Got it now. | 03:55 |
madrazr | jasvir: cool! | 03:55 |
jasvir | madrazr: Let me make a picture. I'll ask you if there is any black spot :) | 03:56 |
*** vijay13 has joined #melange | 03:59 | |
jasvir | madrazr: Now picture is like this. | 04:00 |
madrazr | jasvir: sure | 04:02 |
jasvir | madrazr: 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 |
jasvir | madrazr: Correction | 04:08 |
jasvir | madrazr: Picture is still not clear. {{ mainmenu.render }} is call to function render, which in return call base_templates.MainMenu ? | 04:14 |
madrazr | jasvir: | 04:20 |
madrazr | mainmenu is an instance of MainMenu class | 04:20 |
madrazr | {{ mainmenu.render }} calls the render() method of the MainMenu class | 04:21 |
jasvir | madrazr: thats what i said. | 04:22 |
madrazr | jasvir: is it? | 04:22 |
madrazr | Ok | 04:22 |
jasvir | madrazr: Yes. I'll ask you if there is any other problem :) | 04:24 |
madrazr | jasvir: sure | 04:27 |
*** ashishk has joined #melange | 04:47 | |
ashishk | madrazr: hi | 04:50 |
madrazr | ashishk: Hi | 04:50 |
ashishk | madrazr: 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 |
madrazr | ashishk: run the tests :) | 04:51 |
madrazr | ./bin/run-tests | 04:51 |
madrazr | ashishk: to debug your specific test file run | 04:52 |
madrazr | $ ./bin/run-tests -t pyunit /path/to/your/test/file | 04:52 |
ashishk | madrazr: thanks | 04:56 |
madrazr | ashishk: np | 04:56 |
ashishk | madrazr: did u find the solution for that html rendering in exception? | 04:56 |
*** monkegjinni has joined #melange | 05:00 | |
*** monkegjinni has quit IRC | 05:05 | |
madrazr | ashishk: not yet | 05:10 |
ashishk | madrazr: ok,please tell me when you are done with that :) | 05:13 |
madrazr | ashishk: done? ;-) | 05:14 |
ashishk | madrazr: sorry , :) | 05:15 |
madrazr | ashishk: just kidding | 05:16 |
madrazr | ashishk: don't worry, I will let you know if I find out by before going to bed today | 05:16 |
madrazr | ashishk: if I don't, please do nag me tomorrow sometime. Just in case, to make sure I haven't forgotten | 05:16 |
ashishk | madrazr:yeah sure,i have run the test case it shows OK | 05:16 |
madrazr | ashishk: cool! | 05:16 |
ashishk | madrazr: 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 |
madrazr | ashishk: have you looked at the view code that renders the list for which the error you reported appears? | 05:25 |
madrazr | i.e. for the manage organizations view? | 05:25 |
ashishk | i think view for this page is here soc/app/summerofcode/views/org_app.py | 05:27 |
ashishk | madrazr: in this page there is a class OrgApplicationList in which i need to change ,am i right ?? | 05:28 |
madrazr | ashishk: https://code.google.com/p/soc/source/browse/app/summerofcode/views/org_app.py#1064 | 05:28 |
madrazr | look at that code | 05:28 |
tpb | <http://ln-s.net/B4Xh> (at code.google.com) | 05:28 |
madrazr | ashishk: yes | 05:28 |
madrazr | ashishk: that line is trying to access data.org_app unguarded | 05:29 |
madrazr | ashishk: what happens if org_app does not exist? | 05:29 |
madrazr | since it is unguarded | 05:29 |
madrazr | ashishk: what happens is the error you see | 05:29 |
madrazr | ashishk: now, in order to avoid this bad thing from happening, Daniel suggests | 05:30 |
madrazr | oops, suggests 2 things | 05:30 |
madrazr | ashishk: 1. The code should not even get up to this point if the user directly hits this URL | 05:30 |
madrazr | 2. There should be no UI side affordance for any user to get to this page at all when the org_app does not exist | 05:31 |
madrazr | Solution for 1. is, see a few lines above | 05:31 |
madrazr | access_checker = access.PROGRAM_ADMINISTRATOR_ACCESS_CHECKER | 05:31 |
madrazr | the current access_checker only checks if the user is a program admin | 05:32 |
madrazr | what he says is, in addition to that, it should also check if the org app exists | 05:32 |
madrazr | and if not it should raise an access violation | 05:32 |
madrazr | The solution for 2. is in admin.py | 05:33 |
madrazr | https://code.google.com/p/soc/source/browse/app/soc/modules/gsoc/views/admin.py#376 | 05:33 |
tpb | <http://ln-s.net/B4Xu> (at code.google.com) | 05:33 |
madrazr | this should be conditionally added only if org app exists | 05:34 |
ashishk | madrazr: oh,so for 2. i need to check if org_app exists then add this page otherwise don't | 05:35 |
madrazr | ashishk: correct | 05:35 |
madrazr | you need to do both to fix this problem | 05:35 |
ashishk | madrazr: thanks ,i will check both :) | 05:35 |
madrazr | ashishk: great! | 05:35 |
madrazr | with that, I need to get going. Not a good thing to be in office at 9:30 after Friday :P | 05:36 |
madrazr | *9:30PM on Friday | 05:36 |
*** madrazr has quit IRC | 05:36 | |
*** vijay13 has quit IRC | 05:42 | |
*** RoonyH has joined #melange | 05:47 | |
*** vijay13 has joined #melange | 05:56 | |
*** RoonyH has quit IRC | 06:22 | |
*** asmeurer has joined #melange | 06:35 | |
*** asmeurer has quit IRC | 06:40 | |
*** RoonyH has joined #melange | 06:41 | |
*** ashishk has quit IRC | 07:17 | |
*** vivekjain has joined #melange | 07:51 | |
*** RoonyH has quit IRC | 07:52 | |
*** vivekjain has quit IRC | 07:57 | |
*** vivekjain has joined #melange | 08:10 | |
*** vivekjain has quit IRC | 08:53 | |
*** vijay13 has quit IRC | 08:57 | |
*** jasvir has left #melange | 08:58 | |
*** ashishk has joined #melange | 09:00 | |
*** vijay13 has joined #melange | 09:10 | |
*** madrazr has joined #melange | 09:15 | |
*** ChanServ sets mode: +o madrazr | 09:15 | |
*** vijay13 has quit IRC | 09:15 | |
ashishk | madrazr: 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 orgappsurvey | 09:23 |
ashishk | the value in orgappsurvey comes when i do seed_db | 09:23 |
ashishk | madrazr: also i found somewhere data.org_app_record?? what does it mean ?? | 09:26 |
madrazr | if there is no org application, data.org_app will be None | 09:27 |
madrazr | ashishk: try setting up a new local instance | 09:27 |
madrazr | and experiment | 09:27 |
madrazr | ashishk: ideally what you should be doing is | 09:27 |
madrazr | to write a test case first | 09:28 |
madrazr | then that test case would fail now because the code does the wrong thing | 09:28 |
madrazr | and then that also serves as your path for debugging | 09:28 |
madrazr | then you go ahead and fix the code, using your test to debug | 09:28 |
madrazr | and then after the code is fixed, the test should pass | 09:29 |
*** vivekjain has joined #melange | 09:29 | |
ashishk | madrazr: okay ,i will try using test case :) | 09:31 |
ashishk | madrazr: if i find some other problem i'll ask you :) | 09:32 |
madrazr | ashishk: sure | 09:32 |
*** madrazr has quit IRC | 09:51 | |
*** madrazr has joined #melange | 09:51 | |
*** ChanServ sets mode: +o madrazr | 09:51 | |
*** ashishk has quit IRC | 10:32 | |
*** ashishk has joined #melange | 10:41 | |
*** shikher has quit IRC | 10:41 | |
ashishk | madrazr: 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 |
ashishk | madrazr: 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 IRC | 10:54 | |
*** ashishk has quit IRC | 10:55 | |
*** rocker_ has joined #melange | 11:24 | |
*** jasvir has joined #melange | 11:27 | |
*** rocker_ has quit IRC | 11:37 | |
*** vivekjain has quit IRC | 11:51 | |
*** vivekjain has joined #melange | 11:57 | |
*** Niharika has joined #melange | 12:28 | |
*** RaulT has joined #melange | 12:59 | |
*** jasvir has quit IRC | 13:01 | |
*** jasvir has joined #melange | 13:03 | |
*** run009 has joined #melange | 13:30 | |
*** run009 is now known as ashishk | 13:30 | |
*** RoonyH has joined #melange | 13:39 | |
*** ashishk has quit IRC | 13:42 | |
*** ashishk has joined #melange | 13:42 | |
*** rocker_ has joined #melange | 13:52 | |
*** suranga_ has quit IRC | 13:55 | |
*** RoonyH has quit IRC | 13:56 | |
*** larryxiao has joined #melange | 14:06 | |
*** jasvir has left #melange | 14:20 | |
*** cosenal has quit IRC | 14:31 | |
*** larryxiao has quit IRC | 14:31 | |
*** parx has quit IRC | 14:31 | |
*** mwilkes|away has quit IRC | 14:31 | |
*** harlan has quit IRC | 14:31 | |
*** downey has quit IRC | 14:31 | |
*** nathanielmanista has quit IRC | 14:31 | |
*** Lennie has quit IRC | 14:31 | |
*** olly has quit IRC | 14:31 | |
*** rocker_ has quit IRC | 14:31 | |
*** gsocbot has quit IRC | 14:31 | |
*** hjpotter92 has quit IRC | 14:31 | |
*** Niharika has quit IRC | 14:31 | |
*** Mek has quit IRC | 14:31 | |
*** kblin has quit IRC | 14:31 | |
*** scorche` has quit IRC | 14:31 | |
*** gevaerts has quit IRC | 14:31 | |
*** clopez has quit IRC | 14:31 | |
*** Darrel has quit IRC | 14:31 | |
*** scorche|sh has quit IRC | 14:31 | |
*** schultmc_ has quit IRC | 14:31 | |
*** bytee_ has quit IRC | 14:31 | |
*** antrik has quit IRC | 14:31 | |
*** Triskelios has quit IRC | 14:31 | |
*** trout has quit IRC | 14:31 | |
*** buildbot_beta has quit IRC | 14:31 | |
*** schultmc has quit IRC | 14:31 | |
*** dag10|away has quit IRC | 14:31 | |
*** RaulT has quit IRC | 14:31 | |
*** vivekjain has quit IRC | 14:31 | |
*** ggherdov has quit IRC | 14:31 | |
*** ashishk has quit IRC | 14:31 | |
*** Mek has joined #melange | 14:37 | |
*** ashishk has joined #melange | 14:37 | |
*** RaulT has joined #melange | 14:37 | |
*** vivekjain has joined #melange | 14:37 | |
*** Darrel has joined #melange | 14:37 | |
*** scorche` has joined #melange | 14:37 | |
*** gevaerts has joined #melange | 14:37 | |
*** dag10|away has joined #melange | 14:37 | |
*** schultmc has joined #melange | 14:37 | |
*** kblin has joined #melange | 14:37 | |
*** clopez has joined #melange | 14:37 | |
*** buildbot_beta has joined #melange | 14:37 | |
*** trout has joined #melange | 14:37 | |
*** Triskelios has joined #melange | 14:37 | |
*** bytee_ has joined #melange | 14:37 | |
*** schultmc_ has joined #melange | 14:37 | |
*** ggherdov has joined #melange | 14:37 | |
*** scorche|sh has joined #melange | 14:37 | |
*** antrik has joined #melange | 14:37 | |
*** Lennie has joined #melange | 14:37 | |
*** nathanielmanista has joined #melange | 14:37 | |
*** downey has joined #melange | 14:37 | |
*** olly has joined #melange | 14:37 | |
*** harlan has joined #melange | 14:37 | |
*** mwilkes|away has joined #melange | 14:37 | |
*** asimov.freenode.net sets mode: +oo Lennie nathanielmanista | 14:37 | |
*** Niharika has joined #melange | 14:39 | |
*** kblin has quit IRC | 14:41 | |
*** suranga_ has joined #melange | 14:48 | |
*** Darrel has quit IRC | 14:49 | |
*** scorche|sh has quit IRC | 14:49 | |
*** schultmc_ has quit IRC | 14:49 | |
*** bytee_ has quit IRC | 14:49 | |
*** schultmc_ has joined #melange | 14:49 | |
*** vivekjain has quit IRC | 14:51 | |
*** scorche|sh has joined #melange | 14:51 | |
*** kblin has joined #melange | 14:53 | |
*** kblin has joined #melange | 14:53 |
Generated by irclog2html.py 2.12.1 by Marius Gedminas - find it at mg.pov.lt!