[Zope-dev] PTK Packaging Thought

Anthony Pfrunder s341625@student.uq.edu.au
Tue, 2 Nov 1999 08:19:43 +1000 (GMT+1000)


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