Re: [Tutor] Two problems related to dispathing.

2009-07-28 Thread Mac Ryan
On Tue, 2009-07-28 at 19:03 +0100, Alan Gauld wrote: > There is no simpler solution without changing the class. > If you can do that you could pass the container to the constructor > and get the class to add itself to the container Kent, Alan... thank you very much, indeed I finally

Re: [Tutor] Two problems related to dispathing.

2009-07-28 Thread Alan Gauld
"Mac Ryan" wrote above function. In fact, as I have the need to access the object both individually and with the dispatcher, I am doing something like this every time I instantiate a new object: mycontent = ContentA() contents.append(mycontent) ...but although I "feel" this is silly, I

Re: [Tutor] Two problems related to dispathing.

2009-07-28 Thread Kent Johnson
On Tue, Jul 28, 2009 at 1:22 PM, Mac Ryan wrote: > def invokeAll(method, data): >    """This function is a dispatcher: it invokes all the content types >    of the application calling 'contenttype.method(data)'""" >    return [getattr(content, method)(data) for content in contents] In Python 2.6