Intercept methods/raise exception

Thomas Weholt thomas at cintra.no
Thu Jul 20 08:41:16 EDT 2000


Hi,

Is there a way to define a method in a class that is called each time
every other method is called in that class, and based on a attribute,
raise an exception or let the method-class go thru?

If I could raise some exception each time an object was accessed no
matter what, that would be great too, but I guess that`s stretching it
a bit far.

I need this to control a huge object that's manipulated in many ways,
not always by it's own methods, sometime by altering attributes
directly. If I could trap any change in an objects properties or use
of its methods, that would be the best thing.

Thanks.

Thomas



More information about the Python-list mailing list