IRC log of #novawebdev for Wednesday, 2018-01-31

*** mjsir911 has joined #novawebdev07:56
*** zOnny has joined #novawebdev08:24
*** replaceafill has joined #novawebdev09:02
*** ubuntourist has joined #novawebdev09:11
*** mjsir911 has joined #novawebdev09:26
*** mjsir911 has joined #novawebdev09:34
*** mjsir911 has joined #novawebdev09:48
*** ubuntourist has joined #novawebdev11:03
*** zOnny has joined #novawebdev11:20
zOnnyhey replaceafill11:21
zOnnycan we hang out today ?11:21
replaceafillhi zOnny11:22
replaceafillzOnny, sure, does 3:00 pm work for you?11:22
zOnny3:10 is the time the class ends. replaceafill11:32
replaceafillzOnny, cool, how about 3:30 then?11:32
zOnnyok, replaceafill11:35
*** mr_german has joined #novawebdev13:19
*** jelkner has joined #novawebdev14:07
jelknerGood afternoon, replaceafill! (and mr_german, too ;-)14:08
replaceafillhey jelkner good afternoon14:08
jelknerDo you know which user on #agaric is Micky?14:08
mr_germangood afternoon jelkner 14:08
replaceafilljelkner, freescholar14:09
jelknerwho is Micky-lounger?14:09
jelkneri don't see freescholar14:09
jelknerbut i do see freescholar214:09
replaceafilljelkner, they have some IRC clients set up i think14:09
jelkneri thought that must be it14:10
replaceafilljelkner, that's her too i guess14:10
jelknerlike we have our friend Big_Brother14:10
replaceafilljelkner, yep14:10
jelkneri filled out the web form for ABC Bookeeping14:10
jelknerit costs $175 to talk with them on the phone14:11
replaceafilljelkner, :|14:11
jelknerand a year of payroll is $550014:11
jelknerBRAVO has $35K in the bank right now14:11
jelknerif we have to spend $5500 for payroll, and then get liability insurance, and ... we will soon be broke14:12
jelknerand we won't have done any community organizing :-(14:12
replaceafilljelkner, :(14:12
jelkneri'll learn a lot through this process that will help us with NOVA Web Development14:12
replaceafilljelkner, then we switch to the accounting business ;)14:12
jelknerwell, maybe we could write that open source system that i found in vaporware yesterday ;-)14:13
replaceafilljelkner, lol14:13
jelkneranyway, i'm meeting with my friend Khady Lusby for dinner on Friday14:13
jelkneri don't know if you know about her?14:14
replaceafilljelkner, kind of rings a bell14:14
jelknerShe started a school in Senegal14:14
replaceafilljelkner, is she from africa?14:14
replaceafilljelkner, ah yes14:14
replaceafilljelkner, i remember her14:14
jelknerand a non-profit for it14:14
replaceafilljelkner, was it successful?14:14
jelknerhttp://openinternational.org/14:15
jelkner"sucess" is an interesting term14:15
replaceafilljelkner, good point :)14:16
jelknerher school still exists14:16
jelknerand many young Senegalese students have had their lives changed because of it14:17
replaceafilljelkner, right14:17
jelknerespecially poor, rural girls who would not have made it to university otherwise14:17
jelknerbut it has been a constant struggle for her14:17
jelknerwith finding good employees, with theft, with state bureaucracy, etc.14:18
jelkneranyway, i just called her up.14:18
jelknerand said, "Khady, I desperately need help.  I'm on the board of a non-profit with almost no money that needs to figure out how to do payroll and keep books."14:19
jelkner"I thought to myself, who do I know who is crazy enough to try to do something like that, and I picked up the phone and call you ;=)"14:20
jelknerShe laughed and told me she would meet me for dinner.14:20
replaceafilljelkner, :D14:20
jelknerSo I'll let you know how it goes.14:20
replaceafilljelkner, today i learned jelkner has crazier friends than him ;)14:21
jelkneryes he does14:21
jelkneractually, Khady is one of my biggest "sheroes".14:21
replaceafilljelkner, :)14:21
jelknerLike she told me, "I'm like a dog with a bone. No matter what happens, I just hold on and don't let go!"14:22
jelknerThat's how she is.14:22
replaceafilljelkner, nice term14:22
jelknerI've often told her how she succeeded where Paco and I failed.14:22
jelknerRemind me to tell you more stories when we have the time.14:23
replaceafilljelkner, sure14:23
jelknerLike the time in Senegal where she refused to pay the customary bribes that are normally need to grease the wheels of government approval for things.14:23
*** mjsir911 has joined #novawebdev14:24
jelknerInstead, she just sat outside the office and wouldn't leave until she was taken care of (without paying any bribe).14:24
replaceafilljelkner, wow14:25
jelknerok, i'll let you get back to work14:25
jelkneri'll let you know what i learn on Friday.14:25
replaceafilljelkner, please14:25
replaceafilljelkner, thanks for sharing14:25
replaceafillACTION goes to get lunch, bb in ~4514:31
*** mr_german has joined #novawebdev15:17
replaceafillACTION is back15:17
*** zOnny has joined #novawebdev15:19
*** mjsir911 has joined #novawebdev15:20
jelknerreplaceafill, young master mjsir911 needs your help15:20
replaceafilljelkner, ok15:21
jelknerapparently, he spent all day Sunday trying to do the helios story the way you asked him to, but could not accomplish the goal15:21
jelknera bit more direction may be a big help to him.15:22
jelkneri'll leave it at that15:22
replaceafilljelkner, i was expecting on sunday to hear about it15:22
jelknerwe need to train him to be a bit less self reliant ;-)15:22
replaceafilljelkner, that's fine, we need to train him to deal with deadlines15:22
jelknerthe problem is that he is so much more skilled that i am at this point he knows not to ask me anything15:22
jelknerbut he should ask you15:23
replaceafilljelkner, sure i understand15:23
replaceafilljelkner, we just have to highlight the deadlines part15:23
jelkner+115:23
replaceafillmjsir911, i have a hangout with zOnny in 5 minutes, i expect it to last ~30 mins15:24
replaceafillmjsir911, i'll be here after that15:25
mjsir911I'll draft up an email regarding the problems ive had15:25
replaceafillmjsir911, cool, that works15:25
replaceafillmjsir911, it'd be great if you could show some branch too15:26
mjsir911will do15:26
replaceafillzOnny, ready?15:29
zOnnyyep, replaceafill15:30
mjsir911Well replaceafill I've only got what I have up on the gitlab, we can just discuss the issues here15:48
replaceafillmjsir911, you mean this: https://gitlab.com/novawebdevelopment/helios-nova/tree/feature/embeddedtokens15:50
mjsir911yep thats the one, I didnt realize how close of a name it has to the other branch, but I'll move the other branch somewhere else later15:50
replaceafillmjsir911, ok15:51
mjsir911So my biggest problem that I was experiencing was that the post_save hook was not being called for all the models15:51
mjsir911including the Voter model, the one that I wanted to modify15:51
replaceafillmjsir911, does that work now?15:52
mjsir911No I couldn't figure out how to modify the Voter model on any events15:53
replaceafillmjsir911, ok15:53
replaceafillmjsir911, give me a second i'm recollecting all our communication on this15:53
mjsir911yea ok15:53
replaceafillmjsir911, did i point you at signals some time in the past? i can't find that...15:55
mjsir911I thought you did, but looking I can't either15:55
mjsir911oh, therees an issue on gitlab...15:55
replaceafillah yeah15:55
replaceafillmjsir911, got it15:55
replaceafillmjsir911, i have to admit i get lost in all those projects now.... cc jelkner :(15:56
replaceafillmjsir911, it's here https://gitlab.com/novawebdevelopment/helios-aea/issues/215:56
mjsir911thanks15:56
replaceafillmjsir911, so you need to register your signal handlers15:56
replaceafillmjsir911, let me look for an example how to do that15:57
mjsir911yes, and at one point I used the AppConfig method but I recall that not working so I removed that, but I will do that again15:57
replaceafillmjsir911, ok15:57
replaceafillmjsir911, yes15:57
replaceafillmjsir911, see: https://gitlab.com/novawebdevelopment/event-attendance/blob/master/__init__.py15:57
replaceafillthe default_app_config is what django looks for15:58
replaceafillmjsir911, then you implement it like this: https://gitlab.com/novawebdevelopment/event-attendance/blob/master/apps.py15:58
replaceafillmjsir911, that's how your handlers are registered15:58
mjsir911give me a second to push what I currently have15:59
replaceafillmjsir911, ok15:59
mjsir911so what I currently have now I thought would work, but the class_prepared signal is not being fired for some reason16:04
replaceafillmjsir911, did you add the helios-nova directory to the settings.INSTALLED_APPS?16:06
mjsir911yes I did, but I renamed the directory to `tokens` to go along with the paths in the repository16:06
replaceafillmjsir911, well in your case the app directory should be called "tokens"16:06
replaceafillmjsir911, ok16:07
mjsir911I've traced the path of execution and it seems to be stopping at the import in the ready function in the AppConfig object16:07
mjsir911It's printing stuff out when I put a print in the ready() function, but not when I put a print in the signals file16:08
replaceafillmjsir911, let me try to set it up16:11
mjsir911ok yea16:11
mjsir911I found the problem, changing `import tokens.signals` to `import signals` seemed to run code in the signals file16:16
replaceafillmjsir911, ah ok16:16
replaceafillmjsir911, maybe there's something else called tokens16:16
replaceafillmjsir911, i think we should keep the helios-nova anyway16:17
mjsir911yea and the relative import should have no problem?16:17
replaceafillmjsir911, and maybe relabel it to helios_nova16:17
mjsir911oh yea thats a good idea16:17
replaceafillmjsir911, i was going to do that before deployment but i didn't want to mess with your checkouts16:18
replaceafillmjsir911, so does it work now?16:18
mjsir911well it is importing the signals file16:18
mjsir911And on to the first problem: the `voter_add_field` function + signal dont work if called by the ready() function, because the Voter model is already created16:18
mjsir911The easy fix for this is to just put that function in __init__.py16:19
replaceafillmjsir911, ok, now that the signals are being picked up let me check what the handler is doing16:19
replaceafillmjsir911, ok, we're talking this right: https://gitlab.com/novawebdevelopment/helios-nova/blob/feature/embeddedtokens/signals.py16:20
mjsir911yes, the first function there16:20
replaceafillmjsir911, you don't really want to be modifying any helios model there16:21
replaceafillmjsir911, you want your own model in your app16:21
mjsir911In a seperate table then?16:21
replaceafillmjsir911, so add a new model just with the token field16:22
replaceafillmjsir911, yes16:22
replaceafillmjsir911, i mean16:22
replaceafillmjsir911, you could reuse the table16:22
replaceafillmjsir911, but at this point it's too much effort for so small payofff16:22
*** zOnny has joined #novawebdev16:22
mjsir911Yea ok, I got it to be able to modify the voter class, but having my own models isnt a big deal16:22
replaceafillmjsir911, so the postsave reacts either on creation or modification of the Voter objects16:23
replaceafillmjsir911, so you need to detect what happened16:24
mjsir911but the problem is, it doesnt16:24
mjsir911let me run through creating an election and put the output of those print()s somewhere16:24
replaceafillmjsir911, ok16:24
replaceafillmjsir911, remember to run "manage.py makemigrations" and "manage.py migrate" after you add your model16:26
mjsir911yep, I think I'll do the models later because I don't have any critical problems with them right now16:26
mjsir911the problem I was having was that only some helios models were causing the post_save signal16:26
replaceafillmjsir911, ok16:27
mjsir911link to runserver output here: https://pastebin.com/Ed4FD3F816:32
mjsir911the test_post_save function puts the arguments & sender around stars ***16:32
replaceafillmjsir911, is there an exception in here?16:33
replaceafillmjsir911, it's difficult to see with all the sql debug log16:34
mjsir911I don't think theres an exception anywhere16:34
replaceafillmjsir911, so you're saying the handler gets called?16:35
mjsir911just not for the Voter objects16:35
replaceafillmjsir911, can you push your latest code?16:35
mjsir911sure16:35
mjsir911pushed16:37
replaceafillmjsir911, you uploaded the voter as csv file?16:42
mjsir911yes, is there another way to do it?16:42
replaceafillmjsir911, no i was just checking16:42
replaceafillmjsir911, i'm starting to think the celery worker doesn't trigger the signal16:43
replaceafillmjsir911, csv are processed as celery tasks16:43
replaceafillmjsir911, and the voter object is created then16:43
mjsir911I see16:43
mjsir911I think it could be possible to access the voter objects through VoterFile save or Election save16:45
replaceafillmjsir911, i was thinking the voter file too16:45
mjsir911The only problem I had with using voterfile was iterVoters() returns voterID, name and email, but not the election16:47
mjsir911What is the voter ID? Should I worry about colliding voter ids?16:47
replaceafillmjsir911, the election is a foreign key 16:47
replaceafillmjsir911, i mean, in the voter file16:47
mjsir911I couldn't find a way to access it16:48
replaceafillmjsir911, yeah the problem i see at doing it at that level is that you would need to reproduce most of the "def process" logic16:48
mjsir911self.election, to the best of my knowledge, returned an Election.None16:48
replaceafillmjsir911, it should be self.election, see the process method16:49
replaceafillmjsir911, maybe the object hasn't been saved yet when you checked16:50
replaceafillhadn't*16:50
mjsir911Give me a second to test this out16:51
replaceafillmjsir911, ok16:52
mjsir911Well it doesnt seem to be an election none object, is there any way for me to get all the voters from an election easily to test?16:53
replaceafillmjsir911, from the election? the voter_set16:54
replaceafillmjsir911, each voter has a foreign key16:55
replaceafillmjsir911, to the election16:55
replaceafillmjsir911, you can access the relationship the other way using model name in lower case + "_set"16:55
mjsir911huh?16:56
replaceafillmjsir911, election.voter_set should give you all the voter objects attached to it16:56
mjsir911Oh yea heres the problem: kwargs['instance'].election.voter_set returns helios.Voter.None16:57
replaceafillmjsir911,  what's kwargs['created'] at that point? True?16:57
mjsir911yes16:58
mr_germanreplaceafill, one question, you'll be around at night?16:58
mjsir911{'update_fields': None, 'instance': <VoterFile: VoterFile object>, 'signal': <django.db.models.signals.ModelSignal object at 0x7efe6a3516d0>, 'created': True, 'raw': False, 'using': 'default'}16:58
replaceafillmjsir911,  that means the object hasn't been saved yet16:58
replaceafillmjsir911, so the relationships haven't been fully stablished yet16:58
replaceafillmr_german, no16:58
mjsir911what would you suggest?17:00
replaceafillmjsir911, i really don't want us to reproduce the "check if this voter exists" of the "process" method in the voterfile17:01
mr_germanACTION *sign off*17:01
mjsir911I could very well just regenerate a token if a user is created17:01
mjsir911even if they exist17:02
replaceafillmjsir911, user?17:02
mjsir911Voter, sorry17:02
replaceafillmjsir911, how would you catch that from outside helios?17:02
mjsir911iterVoters() returns voter IDs successfully from the VoterFile17:03
replaceafillmjsir911, depending at the point you iterate that you can have the same issue with the election being None17:05
replaceafillmjsir911, i mean the voter not being really saved yet17:06
mjsir911hmmm yea17:06
replaceafillmjsir911, remind me something17:12
replaceafillmjsir911, no wait17:12
replaceafillmjsir911, can you try this:17:12
replaceafillmjsir911, define the connect without the reeiver decorator17:13
replaceafillpost_save.connect(17:13
replaceafill    test_post_save,17:13
replaceafill    sender=Voter,17:13
replaceafill    weak=False,17:13
replaceafill)17:13
mjsir911what does the weak keyword argument do17:14
mjsir911and should I do sender=Voter or sender='helios.Voter'17:14
replaceafillmjsir911, i can get to the Voter model in the handler17:14
replaceafillmjsir911, no Voter class17:14
replaceafillmjsir911, not string17:14
mjsir911Thats not working for me :/17:17
replaceafillmjsir911, do you have celery working in a different terminal?17:18
replaceafillmjsir911, check the celery log17:18
mjsir911same terminal in background17:18
replaceafillmjsir911, not the server17:18
replaceafillmjsir911, i think you're just not catching the right debug info17:19
mjsir911I wasn't checking there, give me a second17:19
mjsir911Not working for me17:23
mjsir911could you push the changes you've made?17:23
replaceafillmjsir911, i just reverted them17:23
replaceafillmjsir911, but here's my output from celery17:24
replaceafillmjsir911, https://pastebin.com/yBLGmErs17:24
replaceafillmjsir911, see line 11 and 1517:24
mjsir911Yea I see, let me do the same17:25
mjsir911what are you running to start celery?17:25
replaceafillmjsir911, manage.py celery worker17:25
replaceafillmjsir911, i changed the set up shared doc we have recently17:26
replaceafillmjsir911, i hope i didn't break it17:26
replaceafillmjsir911, i'll need to leave in 5 mins17:34
mjsir911ok, I think you've given me what I need to continue17:35
replaceafillmjsir911, were you able to see the Voter model in the logs?17:35
mjsir911Yep, I see it17:35
replaceafillmjsir911, great17:35
replaceafillmjsir911, so you can continue with your same approach17:35
mjsir911How is the idea of modifying the voter model to include a token?17:35
mjsir911Because I think I did get that working, just scrapped it because nothing else was working17:36
replaceafillmjsir911, you don't modify it17:36
replaceafillmjsir911, create a separate model under our app17:36
replaceafillmjsir911, don't touch helios17:36
mjsir911ok17:36
replaceafillmjsir911, just sync it by election + voter id17:36
mjsir911I mean modifying it through the signals though17:36
mjsir911not through changing the source code, but alright17:37
replaceafillmjsir911, you just get data from the voter object17:37
replaceafillmjsir911, no that's what i mean17:37
replaceafillmjsir911, you don't need to modify the voter object17:37
replaceafillmjsir911, just to retrieve the voter id17:37
mjsir911ok yea, make our own models in our own tables17:37
replaceafillmjsir911, and the middleware just checks if the election + voter combination exists17:38
replaceafillmjsir911, ok, shoot me an email if you get stuck17:38
replaceafillmjsir911, or a merge request instead ;)17:38
replaceafillmjsir911, thanks for working on this17:38
replaceafillmjsir911, and sorry for the overhead17:39
replaceafillmjsir911, but it's the clean approach we really want17:39
replaceafillACTION signs off17:39
jelknerACTION signs off18:00
*** mjsir911 has joined #novawebdev21:09
*** mjsir911 has joined #novawebdev22:07

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!