[Zope] overload __getattr__ in brains-class?

Jo Meder jo@meder.de
Sun, 21 Jul 2002 23:52:23 +0200


Am 21.07.2002, 22:19 Uhr
	schrub Dieter Maurer <dieter@handshake.de>:


> But, I think, there is already a new bug report (from someone else).
> Search <http://collector.zope.org>.

That's the first thing I searched but obviously I haven't found the
successfull search term yet. 

>> change "EXTENSIONCLASS_NOINSTDICT_FLAG" to
>> "EXTENSIONCLASS_INSTDICT_FLAG"
[in Record.c]

Well, after changing this flag I had access to __dict__. But that's
about all I gained. __setattr__ and __getattr__ just remained glued to
the definitions in Record.c and no matter what I tried on the
Python-level, I couldn't get them redefined.

> I am not sure, but I think that this is at least necessary.  It might
> also be necessary to modify the "getattr" method (it probably has not
> this exact name) 

It is "Record_getattr" if I parse the code correctly. And it does call
"Py_FindAttr". But this doesn't seem to do me any good since my getattr
won't get called no matter what I try.

I'm really reluctant to start messing with Record.c in earnest since I
really can't claim to understand all side-effects this might produce.
But perhaps this is something more suitable for zope-dev anyway. There
might actually be a good reason for not adding attributes to Records
programatically.

	Jo.


-- 
Internetmanufaktur Jo Meder ---------------------- Berlin, Germany
http://www.meder.de/ ------------------- fon: ++49-30-417 17 63 33
Kollwitzstr. 75 ------------------------ fax: ++49-30-417 17 63 45
10435 Berlin --------------------------- mob: ++49-170- 2 98 89 97
Public GnuPG-Key ---------- http://www.meder.de/keys/jo-pubkey.txt