[Zope] Altering product instance changes all instances!

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Tue, 2 Nov 1999 09:17:20 +1100 (EST)


On Mon, 1 Nov 1999, Edd Dumbill wrote:

> My object subclasses ObjectManager already.  The only way I figure to
> get round this is to add to the constructor some code which clones the
> Image in the class and adds it to the object itself.  I am dubious as to
> whether I can achieve this in DTML -- it's looking like I need an
> external method to achieve it.

Have a look at:
    http://www.zope.org/Members/Zen/tips/tip_ZCatalogInZClass

It shows how to add ZCatalog and ZSearch instances programatically -
the same technique should also work for images.

> I can conceive of a need for ZClasses which subclass ObjectManager to
> come "pre-loaded" with objects, kind of like a default population. As I
> said above, I guess I can achieve this by putting them in the class and
> then cloning them as part of the constructor.

 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen