[Zope-dev] Can't return / publish object of a dictionary?

Lars Heber Lars.Heber@t-systems.com
Fri, 17 Jan 2003 08:52:49 +0100


Thanks for the tips, it was the missing wrapper.

I'm quite a newbie in Python programming, so please forgive me.

I've got two other questions:

1. Say we have a Class A with an attribute myObjects which is just a
list.
Now, I'd like to write my own Class B(A) - it extends A.
But, in Class B, myObjects has to be a method because it has to be
rebuild everytime it is called.
So, how can I do something like:
myObjects = getMyObjects() ?
I tried to do this in the class itself, didn't work.
Also tried self.myObjects = self.getMyObjects() - result wasn't what I
wanted, myObjects got (of course) the resulting list of getMyObjects(),
but I need myObjects to be a reference to getMyObjects()
How to do this?

2. Class A has another attribute, say data, which I want to control in
Class B(A),
i. e. everytime data is accessed (reading or writing), I want to
intercept those actions.
If it was just reading, I could use the strategy from 1., but I also
want to control made changes to that attribute. Do I absolutely have to
rewrite all the methods which access the wanted attribute, or is there
another possibility with some kind of references, perhaps similar to
software interrupts in DOS?

Thanks for your patience!

Lars


--
Lars Heber

T-Systems GEI GmbH
Hausanschrift: Clausstrasse 3, 09126 Chemnitz
Postanschrift: Clausstrasse 3, 09126 Chemnitz
Telefon : (+49 371) 5359-271
Fax     : (+49 371) 5359-133
E-Mail  : Lars.Heber@t-systems.com
Internet: http://www.t-systems.de