[Chicago] How do you troubleshoot cgi errors?

David Rock david at graniteweb.com
Mon Jul 23 19:35:29 CEST 2007


* Ian Bicking <ianb at colorstudy.com> [2007-07-23 12:28]:
> It's actually a tee for any kind of object.  Any method that is called 
> gets called on all the sub-objects (self.files in this case).  It only 
> returns the return value of the last object, but for files you write to 
> there's no meaningful return values anyway.  Similarly it doesn't handle 
> attributes, since it treats everything like a method.
> 
> The __getattr__ method is called when the object has no other attribute 
> -- i.e., if you call obj.foo, then obj.__getattr__('foo') is called (if 
> the object has a __getattr__ method, and no foo attribute).  When you 
> call obj.foo(x), then obj.__getattr__('foo')(x) is called.
> 
> In ReplStdOut whenever you call obj.anything, you get a function back. 
> When you call that function, it gets subobject.anything from every 
> subobject, and calls that with the arguments you pass in.  The function 
> it returns is called a "closure", because the function object remembers 
> the value of "self" and "attr" even though they aren't explicit 
> arguments to the function.  That's all a closure really is -- a function 
> that remembers some extra values.

Wowsers.  I'm gonna have to chew on that one a little bit.  I really
like it, though.  I don't suppose you have any ideas of where to look
for further reading on the concepts, do you?

Thanks again.

-- 
David Rock
david at graniteweb.com


More information about the Chicago mailing list