21 Aug
2000
21 Aug
'00
5:47 p.m.
On Mon, 21 Aug 2000, Philipp Auersperg wrote:
Interesting fact: When retrieving the method object with "m=self.dbTest" and then with "m1=self.__dict__['dbTest']" "print m,m1" show the same string but "m==m1" results to false!
What am I doing wrong? There seems something mixed up with namespaces, but I am too solly to solve it :(
I *think* what you are running into here is the difference between an context-wrapped object and the unwrapped object. I think __dict__ gets you the latter, but self.dbTest calls __getattr__ and the Zope hook for that returns a wrapped object. The wrapped object can use acquisition to find the db connection, the unwrapped object can't. As you found, getattr is the way to do what you want. --RDM