On Wed, 2004-02-25 at 04:22, Max Ischenko wrote:
> Aaron Held wrote:
> 
> > in "context"/__init__.py
> >
> > from MiscUtils.MixIn import MixIn
> > from WebKit.Session import Session
> >
> > from MaxUtils import NotifyCode
> >
> > class SessionMixIn:
> >    def expiring(self):
> >       NotifyCode('Session is ending')
> >
> > # Now inject the methods from SessionMixIn into Session
> > MixIn(Session, SessionMixIn)
> 
> But, is it possible to call the "parent" or "original" method that 's
> been substituted?

I needed this several months, and added this ability to MixIn.  I held
off checking it into CVS because I wanted to run it for a few months to
make sure it didn't break anything (particularly in MiddleKit, which uses
a lot of MixIns).  It has worked fine, though, so I just checked it in.  

If you're not using Webware from CVS you can just make a copy of
MixIn.py and put it wherever you want -- it doesn't depend on anything else
and doesn't need to be in the Webware source tree.

In a nutshell, you want to do:

from MixIn import MixIn
from WebKit.Session import Session

from MaxUtils import NotifyCode

class SessionMixIn:
   def expiring(self):
      SessionMixIn.mixInSuperExpiring(self)  # call original method
      NotifyCode('Session is ending')

# Now inject the methods from SessionMixIn into Session
MixIn(Session, SessionMixIn, mixInSuperMethods=1)

--
Jason D. Hildebrand
[EMAIL PROTECTED]



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to