[Zope] Acquisition problem - please help
Jeff K. Hoffman
jkhoffman@carolina.rr.com
Fri, 17 Dec 1999 14:22:47 -0500 (EST)
On Fri, 17 Dec 1999, Dave Parker wrote:
> "Jeff K. Hoffman" wrote:
>
> > It's the physical path combined with the context in which the acquisition
> > is occurring. I think. :)
>
> That sounds more like what's going on (and helps - thanks).
Cool. I will try and do a semi-formal How-To on my recent research into
acquisition and put it up on Zope.org.
> > ZClasses are contained in a product. So, yes, to use a ZClass, the product
> > that contains it must be installed. ZClasses are "above" the OFS, so to
> > speak.
> >
> > > My trouble has been in imagining what the development cycle for a
> > > specific application (not a generic product) would look like in that
> > > context.
> >
> > I am using ZClasses for a specific application. I just make sure they're
> > installed on whatever server is going to serve my app. :)
>
> Yeah, I presumed the "must be installed" issue ;) I'm wondering about
> the underlying mechanism: when you create an instance of a product, how
> does it relate to the product itself? Put another way: when I make
> changes to the product, do I have to re-install it to get those changes
> to kick in?
Speaking abstractly, a ZClass determines the "template" that all instances
are made from. In technical terms, all of the instances "inherit" (for
lack of a better word) the attributes of their ZClass. If you put an
object (say, an Image) in your ZClass, that one single instance of the
image is shared across all instances. In Java terms, these are like
static, or "class level" attributes. By default, the only permission given
to class attributes is "View", so that instances cannot modify shared
attributes (though this can be changed in the "Define Permissions" tab.)
If you want each ZClass instance to have its own instance(s) of a
particular class, you can use the ZClass constructor to construct instance
attributes inside the instance itself. As far as I know, this means that
when you update your ZClass and change the way instance attributes are
created (via the constructor), you must re-create all of your instances.
There might be a better way of doing this sort of thing, but I haven't had
the time to look into it, yet.
I have found that using ZClasses and acquisition, in combination, I can
achieve most of the designs my OOA&D background permits me.
--Jeff