From: Adrien Di M. <Adr...@lo...> - 2003-02-26 16:50:37
|
Hi all, I'm pretty new in AOP, and I'm looking for all kind of AOP-related stuff for Python. I found Pythius, and I'm trying to use the Logger aspect in a small program. It seems to work fine, but I had a small problem. I would like to add some log-events when a list is modified. Suppose I have : ##################################### class A: __metaclass__ = aop.Metaclass _aspect = my_logger() def __init__(self): self.l = [] ... ##################################### What I would like to do is to check when "self.l" is changed (self.l.append() or self.l.pop() or ...) . I tried to add a "self.before('setattr', 'l', self.list_changed)" but it didn't work. How could I do what I'm trying to do ? This may be a basic problem, but I'm a newbie with all this stuff. Cheers, Adrien. -- Adrien Di Mascio LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org |