Ok, so I can see the value of MixIn() in some cases rather than subclassing,
depending on what you are doing. However in my case, I wanted to replace the
createApplication method on ThreadedAppServer, and I tried doing this in the
__init__ method of my module.  

I need to import my module prior to starting the ThreadedAppServer because I
want to affect how the ThreadedAppServer starts.  If I do this, then the
Application method addContext() fails to call contextInitialize() because
the module has already been loaded.  

Perhaps addContext() should be maintaining a list of contexts which have
been initialized, rather than just initializing them if addContext() is the
actual place where they are loaded?

-Stuart-


> -----Original Message-----
> [mailto:[EMAIL PROTECTED]]On Behalf Of Ian
> Bicking
> 
...
> It's not so much a Python thing.  I originally thought 
> subclassing would
> be best, but I realized that they it can be awkward in some ways.
> 
> If you want to use local subclassing you could always just change the
> import statement to use your local subclass.  This won't be entirely
> seemless for upgrading, but I don't think that's a big problem.  Of
> course, you couldn't easily distribute the enhanced class -- 
> but I think
> that's a problem anyway with subclassing.  You can distribute a
> subclassing of a single class, but that doesn't leave a good 
> way to use
> two customizations (even though they might not otherwise conflict).
> 
> Even if it seems kind of weird, I think the mixin approach solves most
> of these -- if you make your customization into a plug-in, it 
> can change
> the classes when its initialized.  This should make it easy to
> distribute customizations.


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to