IRC Logs for #circuits Thursday, 2013-03-07

*** Osso has joined #circuits00:58
spaceoneprologic: i am trying to convert today, you said 2 hours are realistic :D10:32
spaceonei have some questions10:33
spaceoneweb.Server is the same as BaseServer() + Dispatcher()10:33
*** Osso has quit IRC11:03
*** Osso has joined #circuits11:10
spaceoneprologic: why do you always do type(foo) == bar instead of isinstance(foo, bar) as it is recommendet?11:23
spaceoneand you are often using 'See' in documentation.. you could use the sphinx builtin .. seealso::11:24
*** Osso has quit IRC11:43
*** patx has joined #circuits12:06
spaceoneis there an access log?12:28
*** patx has quit IRC12:43
prologicmorn'n all13:02
prologicyes circuits.web.Server13:02
prologicis circuits.web.BaseServer + circuits.web.dispatchers.Dispatcher13:03
prologicplus also the HTTP protocol component :)13:03
prologicaccess log, yes13:03
prologicfrom circuits.web import Logger13:03
prologicLogger() + ...13:03
prologicspaceone, where are you seeing type(foo) == bar?13:03
prologicyou are correct, isinstance is preferred in most cases13:04
prologicand See: -- good point13:04
prologicWasn't really aware of :seealso:13:04
prologicI'll write up some stories to cover these for upcoming releases13:04
prologicAhh yes13:09
prologicI agree13:10
spaceonealso in web/dispatchers/jsonrpc13:10
prologicthose should be replaced with isinstnace13:10
prologicI'll write up a story as such13:10
spaceonei will grep for some others13:10
prologicthanks :)13:10
spaceone2*core/, core/ multiple times13:11
prologicFound them all13:11
prologicfiled as a story13:12
prologicnow I have to leave for the bus shortly13:12
prologicanything else?13:12
prologicI am online everywhere though :)13:12
prologicZNC ftw :)13:12
spaceone:D nothing more13:13
prologicsweet :)13:13
prologicglad it's working well for you so far13:13
prologicYes - you do have to drop CP specific code13:13
prologicit's not possible to map every concept :)13:13
prologicbut we believe we provide enough to do everything you'd ever want13:14
spaceoneand circ. is obviously the cleaner one13:14
prologicwithout overstepping the fine line between web framework and web application13:14
spaceoneof course13:14
spaceoneyou provide much more than CP13:14
prologicin what way?13:14
prologicwe certainly don't provide as much as Django, or Plone and we never will :)13:15
spaceonenearer to the socket through those events13:15
prologicahh well13:15
prologicthat's just a coincidence13:15
prologiccircuits.web is just built on top of circuits - an already powerful framework13:15
prologicso writing circuits.web was actually really easy13:15
prologicmost code was not particularly hand written13:15
prologicit was borrowed and retrofitted13:16
prologickoobs, I'll be on my iPad in a few mins13:16
prologicnow where were we ;)13:19
spaceonel8er... i have to programm ;)13:20
spaceonei only have 164 hours to finish the project13:20
prologicOsso pong?13:38
spaceoneprologic: i want to make a local request (fake request)... how can i do this easily?13:38
prologicfire a Request event13:39
prologicBut are you sure you want to do this?13:39
prologicYou could just fire an event that some other component responds to?13:40
spaceonealternatively i only need a Request() and Response() object13:40
prologicWhats the use caee?13:40
prologicIve never done it :)13:40
spaceonegetting response from a resource13:41
prologicsuch as?13:41
spaceonei have 3 resources: Navigation, Page, SomeResource13:42
spaceonewhen requesting SomeResource i need to request Page() if content_type == html, Page requests Navigation()13:42
prologicand these are what?13:43
prologicVontroller subvlasses?13:43
spaceonehmm, they are BaseComponent i think13:44
prologicSo in theory a browser could request these incomplete parts?13:44
prologici.i they have urls13:44
spaceonei want to do this:13:45
prologicthis sounds to me like youre trying to do templating without a template engine like make, jinja2 or genshi13:45
spaceonelocalrequest('GET', '/foo', headers={}).response.body13:46
spaceoneoh yes, i am using genshi13:46
spaceonebut this will not work, because i am working with Resources13:47
spaceone(they are only accessable via HTTP)13:47
spaceoneand they are optional, i don't want to wrap content arround every request13:47
spaceonealso i sometimes need to GET the representation of another resource13:48
prologicin any case, creating a Request event with Request and Response objects as arguments will create you a fake request13:49
prologichmmm interesting13:50
spaceoneand another thing: is there something like a InternalRedirect exception?13:50
prologicyouve got me thinging ;)13:50
spaceonegood so13:50
prologicno im agraid not /;13:50
prologici guess we overlooked the need for one13:51
prologichowever you could filter the request13:51
prologicfilter it before it hits the dispatcher13:52
spaceonehmm, i currently handle errors with InternalRedirect: example:13:53
spaceonerequest to /foo raises an exception13:53
prologiclook at how i handle errors in sahriswiki13:54
spaceonei will catch and: raise Redirect('/error', exception)13:54
prologici filter the error and rewrite the response13:54
prologicfilter it and rewrite the response ;)13:55
prologicas if it were an internel redirect to /error13:55
prologicor refirect the user via a real redirect13:55
spaceoneok, nice13:55
prologiceither way filters are your friend!13:55
spaceonethat was not easy in CP so i used to use internalRedirect13:56
prologicwe prefer eventing and filtering in c.web13:56
prologicits more powerful and flexible13:57
prologicdont forget we have call and wait primitives too13:57
prologicand use worker pool for any CPU bound work13:58
prologicumm yeah we mostly have the same attributes with dome differnces13:58
prologicchecj wrappers.py13:59
prologicrequest.path in this case13:59
spaceonehmm i don't like the response.code name14:13
spaceoneresponse.status is nicer14:13
spaceoneah there is a property status which does not have an setter14:15
prologicwhat dont you like? ;)14:15
prologicWe can fix it!14:15
spaceoneprologic: web.wrappers.Response.code.setter = lambda self, code: self.code = code14:31
prologicyou suggesting a ,od?14:32
spaceoneprologic: web.wrappers.Response.status.setter = lambda self, code: self.code = code14:32
spaceonesorry :D14:32
spaceonemaybe i will patch cherrypy and use 'code'14:33
spaceonethat makes propably more sense14:33
prologicheh ;)14:34
prologicdont mind suggestions and modifications ;)14:34
prologicdiscuss, fork, pull request :)14:35
spaceonemessage is btw the wrong word: in HTTP it is called reason-phrase14:35
prologicso far i dont  think circuits.web had pissed anyone off (yet) :)14:36
prologicwell not me at least :)14:36
prologicYes you are probably right14:37
spaceone6.1.1 Status Code and Reason Phrase14:37
spaceoneRFC 261614:37
prologici think if we're going to change that we write a Status class with properties14:37
spaceonei have one14:38
spaceonesee SF.core.http.HTTPStatus14:38
prologicIll have a look at the code when i get to work!14:38
spaceonedon't forget to 'svn up' before14:38
prologicIll write a patch this morning and see what you think14:39
prologicshould be at work soon14:39
spaceonewhat is the time at yours?14:39
spaceoneAM or PM?14:41
prologictakes me 2hrs to get to work :/14:41
prologicThat was 24hr time :)14:42
spaceonewhere do you live?14:42
spaceoneah ok14:43
prologicet u?14:43
spaceonei am from germany, it is 23:4214:43
prologicahh nice14:45
prologicanother german circuits user :)14:45
prologichopefully wr can convince you to spare some dev time! ;)14:46
spaceoneof course, when SF is finished :D14:46
prologicHave you met Osso and mehere yet?14:46
prologicThetre our other two avtive drvs14:46
prologicAlso jg does a lot of production work with circuits for clients14:47
prologicUpdated this page last night14:49
prologicBy all means fork it and add yourself!14:49
prologicAnd sybmit a pull req ofc14:49
prologicok finally at work :)15:28
prologichey spaceone15:41
prologicif all an internal redirect is doing is modifying the path15:41
prologicthen we already have this in the form of filters15:41
prologici.e: filter the request and modify the path15:41
prologicyou just have to do it before it hits the dispatcher15:41
prologicotherwise it's a bit too late :)15:41
spaceoneprologic: it also changes the HTTP method15:42
spaceoneand sometimes other things like headers15:42
prologicfiltering can do all that :)15:42
prologichmm just looking at your HTTPStatuc class15:43
prologicwhat's the description for?15:43
spaceonethat is the response body15:43
spaceonei am using this for error handling15:43
spaceonecompile the file to see description examples ;)15:44
spaceonei will commit in ~15 minutes my latest changes to circuits support15:47
spaceoneprologic: i need the cherrypy HeaderMap.values method15:51
prologicI propose the following change(s):15:54
prologicself.request.headers.values() ?15:54
prologicit's just a dict15:55
prologicit's there15:55
prologicoh what do you mean theN?15:55
spaceoneit is the wrong thing15:55
spaceonecherrypy implemented an own15:55
spaceonevalues(header_name): returns ordered list of Accept-elements (q=*)15:55
prologicso we're talking about parsing the Accept header?15:56
spaceoneand Accept-Language, Accept-Encoding, Accept-*15:57
prologicI'm pretty sure we already support that15:58
prologicremember we _did_ borrow a lot of cherrypy code15:58
spaceonei will look at it15:59
spaceoneyour patch looks ok15:59
spaceoneyou could raise an Exception if not 99 < status < 60016:00
prologicbut I usually don't like raising arbitrary exceptions for the hell of it :)16:01
spaceoneand why do you use .format ?16:01
prologica "Programmer" should know what they're doing :)16:01
prologic"foo %s" % "bar"16:01
prologicis going away in Python 316:01
spaceonei loved this16:01
prologicjust tested this out too btw16:02
prologicthe header element parsing16:02
prologicit works16:02
prologicI've never used it though16:02
prologicand we have no tests for it16:02
prologicso we're kinda trusting cherrypy here :)16:02
prologicat least the code we borrowed many years back16:02
prologicI doubt much of this has changed though16:03
spaceonethe header_element thing does not the same as .values() do16:11
spaceoneif i do str(h.elements('Accept')[0]) i get 'foo/bar;q=2'16:12
spaceoneeverything is correctly sorted there but i can't get rid of the q=* thing16:13
spaceoneok, i can do [e.value for e in self.elements(key)]16:16
*** koobs has quit IRC16:32
*** spaceone has quit IRC16:32
*** spaceone has joined #circuits16:32
spaceoneprologic: svn diff -r 505:507 | vim -16:36
spaceoneif you want to see what changes i did to make cicuits workable16:36
prologicit would be good if you could fork and submit small pull requests16:37
prologicI prefer it in small units of work16:37
prologicso we can talk about it more easier and track changes16:37
prologichg record ftw16:37
spaceoneprologic: there is not really something which must be changed16:39
*** koobs has joined #circuits16:40
prologicnew status code works16:41
prologicI've implemented it as a data descriptor now16:41
spaceonei have to sleep now, it is 01:39 and i have to work tomorrow16:41
prologicoh i see16:41
prologicso you haven't changed anything in circuits yet?16:41
spaceonea little bit:16:41
prologichmm ok16:42
prologicif you do improve anything16:43
prologiclet us know :)16:43
spaceonethis are my hacks16:43
spaceoneyes, i will of course, but i have to work on SF first16:43
prologicI'm not sure what's different here :)16:43
spaceoneafter this i will join the project ;)16:43
prologichg diff | codepad16:43
prologicnps :)16:44
prologicgo get some sleep :)16:44
spaceoneyep, gn816:44
prologicI did :)21:06
prologicjust mentioning what you use circuits for :)21:06
prologicDo you know we have online irc logs?21:06
jgiorgiyeah but i haven't looked at them22:18
jgiorgimy bouncer should be online 24/7 she sits on two geo-diverse servers with a redundancy module that keeps everything online22:20
jgiorgipowered by circuits of course22:20

Generated by 2.11.0 by Marius Gedminas - find it at!