PTK Packaging Thought
Hi, In working on KM|Net News, it has come to my attention that ZClass-based products are very easy to modify, but not very easy to upgrade once you have made changes. You could subclass the ZClasses, and make your changes in there. But, your new ZClasses have to be in the same product (making upgrades more difficult) and, if there is a factory, both ZClasses show up in your add list. I think this will be pretty relevant to the PTK. Let's say that the "News Item" does just about everything I can do with KMNN, but does not have the feature that allows readers to rate the articles. It would be nice if there was a mechanism allowing me to create my own extended News Item with extra properties and methods, but to still be able to easily upgrade when new versions of the PTK are released. Maybe a solution is to have ZClasses be subclassable between Products (even if there is no factory). Then, the PTK Product could have the basic "News Item", but the Zope user can subclass this in their own Product and delete the original factory so that only their new News Item shows up. Upgrading then becomes easy... just drop in the new Product and remove any unwanted factories. Does any of this make sense, or have I had a little too much Halloween candy? Kevin
On Mon, 1 Nov 1999, Kevin Dangoor wrote:
Hi, [snip] Maybe a solution is to have ZClasses be subclassable between Products (even if there is no factory). Then, the PTK Product could have the basic "News Item", but the Zope user can subclass this in their own Product and delete the original factory so that only their new News Item shows up. Upgrading then becomes easy... just drop in the new Product and remove any unwanted factories.
You can already do this. For example, to use the base Python-level class of another Product: import Products.MYProduct Then, add to your init function: def __init__(self): MYProduct.__init__(self) self.MYProduct = MYProduct Then, to upgrade, just update the ZClass associated with MYProduct and delete the factory. The low-level python code will continue to link to the methods of MYProduct (implicitedly or explicitly via self.MYProduct) This is the technique I use to merge XML Documents and XML Widgets with my custom code. Cheers, Anthony Pfrunder
participants (2)
-
Anthony Pfrunder -
Kevin Dangoor