IRC Logs for #circuits Monday, 2013-07-22

prologicthis still works for me00:00
prologicyour example is essentially the same00:01
prologicwhy does mine work and yours doesn't?00:01
jgiorgiwtf!? your example works but mine doesnt?00:01
jgiorgithey're practically the same00:01
prologicI know00:01
jgiorgias soon as i change the channel it fails00:02
jgiorgicalling on "*" works but "foo" does not00:02
jgiorgiregardless of the channel of the component handling the event00:02
prologiccan you debug that and work out why?00:08
jgiorgii'll give it a shot00:20
jgiorgiwhere is the code that handles this?00:21
prologicall in circuits/core/managers.py00:25
jgiorgihrmm i was not aware that call was effectively wait00:26
jgiorgithat worries me00:26
jgiorgiw00t fixed it!00:36
jgiorgicallEvent wasnt unpacking event.channels before passing to waitEvent thus ("foo",) becaue (("foo",),)00:38
jgiorgirunning tests to ensure i didnt break anything00:38
jgiorgitests pass!00:40
prologichey nice work dude00:45
prologicimpressive :)00:45
prologicyeah nice job00:46
prologicand yes call is essentially fire + wait00:46
prologicnothing special00:46
prologicwe call it "call" because the semantics look like a normal function call00:46
prologicexcept for the use of yield, etc00:46
prologicx = yield
jgiorgione of those things that's so simple it's easy to overlook, it took me plugging in print statements everywhere to find it00:47
jgiorgimy concern is that since wait just looks for an event name and channel and not a unique event object we could get crossed events00:48
jgiorgiie two handlers call a Render event, same name, same channel, the two handlers get the wrong value00:48
prologicyes I do agree00:49
jgiorgiif one handler was a search box and the other was an admin control panel then an unauthorized user just got a peak at the admin panel00:49
prologicisn't there support in the code to wait for a specific event instance (object)?00:49
prologicI thought we did that00:49
prologicso you could do:00:49
prologice = Foo()00:49
prologicx =
prologicx = yield self.wait(e)00:49
prologicsorry forgot the yield00:49
jgiorgii dont see it in the code, but i think it would be really easy00:50
prologiccode it up and write a test for it00:50
prologicand make sure you don't break others :)00:50
jgiorgithe event object passed to _on_event should be equal to the event object passed to waitEvent right?00:50
prologicbasically you want to use the event object's identifier00:50
prologici.e: id(e) or something00:51
jgiorgithus (eventIN == event) == True ?00:51
prologicI think so00:51
prologicbut I think Event implements equality though00:51
prologicso you should probably compare their identities instead00:51
jgiorgii'll make the changes and make sure no tests are broken00:52
jgiorgithen i'll write a test that verifies it works00:52
jgiorgiso thats my change, all tests still pass01:04
jgiorgii'm stuck on how i would write a unit test for that tho01:04
jgiorgii've tested that it works by firing multiple identical events to an event handler that returns the event's id and testing that the value returned by call was the id of the event i called01:18
prologicwell doesn't that satisfy the functional behavior?02:08
prologicyou write your test in a way that ensures "correct behavior"02:08
prologicI'm not happy with that change02:09
prologicId' rather waitEvent be modified in a way that lets you pass an event object02:11
prologicor an event  name02:11
prologicand perform appropriate checks depending on the type passed in02:11
prologicinstance (event object) or name (str)02:11
prologicthe semantics of callEvent should then by changed so it passes in the event object (instance) and not event.name02:12
prologicso you wait for that actual event object (instance) to be completed -- and not just some arbitrarily identically named event02:12
jgiorgiyou and accepting arguments as more than one possible type....02:16
jgiorgifine, it'll take me a bit to rework it02:16
prologicthat's what Python is all about :)02:19
prologic"duck typing" :)02:19
prologicI'd prefer it than having to know to pass obj=blah02:20
prologicbecause that makes the API more difficult to understand02:20
jgiorgiwell any attempt i make to do it that way breaks all the tests02:42
jgiorgiand all i'm doing is a simple issubclass02:43
jgiorgiugh </3 py.test02:48
jgiorgifixed it02:48
jgiorgihow about
jgiorgialso my normal priority handler on "request", "web" doesn't seem to be executed, i think it's just priority, i'm looking at it03:01
prologicif this works and passes all tests03:57
prologicincluding your new test03:57
prologicthen this is acceptable03:57
*** jgiorgi-home has joined #circuits04:12
jgiorgi-homedamn it04:12
*** jgiorgi has joined #circuits04:13
jgiorgiany prologic how would i write a test for this, also refresh my memory, event handler priority lower integer == higher priority right?04:14
prologichigher value, higher priority04:15
prologicwhich is now confusing with firing higher priority events04:15
prologicwith the heapq implementation that we now use04:15
jgiorgiok so priority for handlers and for events is the same then04:16
jgiorgiat least it's consistent :)04:17
prologicexcept if you want to fire a higher priority event04:21
prologicthen it's the opposite04:21
prologicwe really should find a way to fix that04:21
prologicremember the new feature04:21, priority=...)04:21
jgiorgiwait i thought that higher integer == higher priority when firing an event04:21
prologicbecause that's the default behavior of a heapq04:22
prologicI don't think so04:22
prologiccheck the test :)04:22
jgiorgiyou're right, the test shows lower integer == higher priority04:22
jgiorgithat is a glaring inconsistency04:22
prologicit is04:23
prologicfind a way to reverse that :)04:23
prologicdo some research on python heapq's04:23
prologicmaybe there's an easy one liner fix :)04:23
jgiorgiprobably is04:24
jgiorgiim on client time atm so cant but i'll take a look at it before i go to bed04:24
jgiorgitrying to get an ssl server up atm never have managed one with circuits04:25
prologicyeah ssl should work fine04:26
prologicat least the tests pass :)04:26
prologicit's a self-signed cert04:26
prologicbut should not make a difference04:26
jgiorgino that wouldnt effect functionality04:27
jgiorgiand i have real certs04:27
jgiorgior at least real as in signed by cacert04:27
jgiorginope... cipher errors04:31
prologicdid you build python properly with ssl support?04:35
jgiorginah but i fixed it04:35
prologicremember you have to provide it a pen file04:35
prologicfix was?04:35
jgiorgiyeah my pem file contained a typo04:35
jgiorgimissing a - at the private key end04:35
prologicheap that would do it04:44
prologicand throw weird errors like that04:44
jgiorgiprologic, it seems that you or someone has added the basic framework for client certificates in circuits.web05:20
jgiorgii added passing **kwargs from Server to TCPServer to allow me to pass cert_reqd and ca_certs it worked and now all my handlers get the user's certificate information as the first argument05:21
jgiorgicant find the code thats doing that tho05:31
prologicyou'll find it05:40
prologicit's in circuits.web somewhere05:40
prologicand yes that is a little annoying05:40
jgiorgiyeah i found it05:40
prologicI think it's in circuits/web/wrappers.py05:40
prologicif you can find a better way05:40 actually05:40
prologicplease by all means propose it and show a diff/pull-request05:41
jgiorgiyeah now im just trying to figure out how to get a fingerprint of the cert05:41
jgiorgii don't want to trust by the email in the cert (even though for a ca to sign it they must have validated that email)05:42
jgiorgii'd rather trust a single cert05:42
*** tpelka has joined #circuits05:46
jgiorgimodified that behavior btw, passing the peer cert as the first argument makes it difficult to mix one-way and two-way ssl, bound it to the request object instead05:53
prologiclook forward to your pull request(s) :)06:13
jgiorgiwell i've written it into my authentication to look for certs and just match them (assuming that if all values are the same the cert is the same, fairly safe assumption given that i dont accept self-signed certs)06:27
jgiorgiseems to work, i'll check everything over in the morning, for now it's time for me to go to bed06:28
*** koobs has joined #circuits09:56
*** koobs has quit IRC09:56
*** koobs has joined #circuits09:56
*** amee2k has quit IRC13:10
*** amee2k has joined #circuits13:14
*** tpelka has quit IRC14:40
*** jgiorgi has quit IRC23:00
*** jgiorgi-home has joined #circuits23:00

Generated by 2.11.0 by Marius Gedminas - find it at!