[Zope-dev] a simple example of the ZPatterns frame work

Bill Anderson bill@libc.org
Wed, 17 May 2000 23:29:44 -0600


"Phillip J. Eby" wrote:
> 
> At 08:39 PM 5/17/00 +0400, Jepthte CLAIN wrote:
> >
> >I wonder if someone can send me a simple example using the ZPatterns
> >framework. I read all the source, and I still can't figure out what is
> >the relationship between the objects instantiated by the Racks and the
> >Rackmountable objects. Also, why do the rack try to instantiate a
> >ZClass???
> 
> When created, Racks create some default Attribute and Sheet providers.
> These objects are used by Rackmountables to access data which is not stored
> directly in the rackmountable.
> 
> When used, Racks create instances of the ZClass you've specified.  If you
> call newItem(key), you will receive a new instance of that ZClass, which
> will be stored in the rack under the specified key.  Whenever you call
> getItem(key), the instance will be retrieved.  Some Racks, like
> GenericUserSource, do not store items in themselves, but in external
> databases.  When you call getItem(key) on a GUS, it calls methods to access
> the external database, then creates an instance of the appropriate
> LoginUser subclass and returns that.
> 
> Hope that helps; I'm not 100% clear on your question.


It helps me a litle. I think what Jepthe was asking for though, is a
simple howto. For example, lets say I wanted to implement a image-like
object that stored the actual in a SQL database, for example, with
'meta' information (photographer, date, category, etc) stored in the
ZODB for indexing and management. A walkthrough on how to do this
would be especially useful at this stage. At least, that's what I
interpreted Jepthe as wanting.

no-my-desire-for-this-colored-my-perception-in-way-:^)-ly y'rs Bill