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

prologichey all01:18
prologicback from holidays01:18
*** jgiorgi has quit IRC03:30
*** jgiorgi has joined #circuits04:13
*** jgiorgi-home has joined #circuits04:13
*** jgiorgi-home has quit IRC04:13
*** jgiorgi has quit IRC04:26
*** jgiorgi has joined #circuits04:44
jgiorgiprologic, is it possible to change the behavior of Controller.redirect to ignore the actual Server bind ie behind a proxy self.redirect("/") redirects to host:port/ rather than host/, that port being bound to localhost only the redirect fails06:28
prologicUmm06:29
prologicI believe you found the same bug I had06:29
prologicwhich I fixed recently in dev06:29
prologiclet me check that I pushed it up06:29
jgiorgioh well, i found it days ago and just wrote a workaround (specifying the full URL)06:30
prologicyes I did push that fix up06:31
prologicYou should find it fixed in dev06:32
prologicbe aware though if you are using Apache06:32
prologicyou need to enable the following in your virtual hosts06:32
prologicI found this out the hard way06:32
prologicProxyPreserveHost On06:32
prologicThis needs to be turned on if you are doing reverse parodying like I do with my deployments06:32
prologicproxying*06:33
jgiorgii am using apache and i have that enabled, will be switching to a lighter proxy soon but that means putting some legacy systems on a proxy so i havent done it06:33
prologicsure nps06:35
jgiorgiok so next question, the current dispatcher will send /foo/bar to my index handler because i accept two kwargs, a lot of what should be 404s are getting caught by the index handler instead06:35
prologicanyway it is fixed in dev06:35
prologichopefully when I get my desktop finally fixed06:35
prologicI'll push a new release of circuits06:35
prologicuntil then, use dev :)06:35
jgiorgiis there a method to specify the type of arguments a handler should accept or to detect how the arguments were provided06:35
prologicwhat does your index handler look like?06:36
jgiorgii usually use dev, i'm just careful about updating :)06:36
prologicthe parameters06:36
jgiorgidef index(q=None, query=None):06:36
prologicic06:36
prologicand the channel for this controller is?06:36
prologic /bar ?06:36
jgiorgi"/"06:36
prologicoh i see06:36
prologicgimme a sec06:37
jgiorgiso any two deep url (ie /foo/bar) which doesnt exist elsewhere is handled by /index06:37
jgiorgiif i could say "only accept GET arguments" or if i could check if the arguments are GET/POST/url i could correct that even if it means manually throwing 404s06:38
prologicahh yes06:39
prologicI see now06:39
prologicI reproduced what you're seeing with this:06:39
prologichttp://codepad.org/q5jiQ1M506:39
prologicunfortunately this make sense though06:39
prologicGET /foo wil 40406:39
prologicbecause nothing matches that takes only 1 argument06:39
prologictechnically however it should not 40406:39
prologicwhen you think about it06:40
prologicbut GEt /foo/bar doesn't 40406:40
prologicwell ...06:40
prologicyou can implement:06:40
prologicdef GET(self, q=None, query=None):06:40
jgiorgioh yes i understand why the index handler is called, treating parts of the url as arguments is a feature i use frequently06:40
prologicwhich will only match GET requests06:40
prologic*nods*06:41
prologiclike I said06:41
prologicGET /foo returning a 404 is a bug ihmo06:41
prologicbecause your only handler takes 2 optional arguments06:41
prologicso technically GET /foo should not 40406:41
prologicneither should GET /foo/bar06:41
prologicbut06:41
jgiorgii agree06:41
prologicGET /foo/bar/baz should 40406:41
prologicthere is no handler that takes 3 arguments06:41
prologicsomething worth looking into in the logic06:42
prologicI don't like inconsistencty06:42
prologicPlease report such a bug06:42
jgiorgiso GET would handle / but require them to be GET encoded? (i assume POST does the same for POST?)06:42
prologicbut not about the behavior your seeing06:42
prologicabout the fact that the code I pasted above06:42
prologic404's for GET /foo when it should not06:42
prologicno no06:42
prologicGET/POST/PUT/DELETE/PATCH etc06:42
prologicjust matches against the method06:43
prologicnothing more, nothing less06:43
prologicit ignores arguments altogether IIRC06:43
prologicif your controller has a def POST(...)06:43
prologicthat method will handle all POST(s)06:43
prologicso it's best to do things like:06:43
prologicdef POST(self, *args, **kwargs):06:43
prologic   ...06:43
jgiorgibut within the controllers channel i assume?06:43
prologicit's so you can do RESTful more easily06:43
prologicyes of course06:44
prologicit still does the "best match" path logic06:44
jgiorgithat will work exactly like what i need06:44
prologicwell it ought to :)06:44
prologicit was designed to be "best of both"06:44
prologicas much as possible06:44
prologicbut please still write a quick bug report about what I said ebove06:44
prologicwith the inconsistent behavior06:44
prologicI'm heading home shortly (from work)06:45
prologicin fact now06:45
prologiccya :)06:45
jgiorgii will certainly file a bug report06:45
jgiorgithanks for the help06:45
jgiorgiprologic, why would a page handler get a request object as it's first argument (or as the keyword argument "user")?08:43
jgiorgii'm encountering this somewhat intermittently08:43
jgiorgigot it, not sure exactly how it happened but i'm going to try to find a test case08:50
jgiorgiseems like a REALLY obscure bug that occurs when i'm doing something i shouldnt be (namely making a controller assume a request)08:51
*** FSX has quit IRC10:37
*** FSX has joined #circuits12:37
prologicjgiorgi:  can you elaborate ?23:25

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