[Zope] - USING THE ZOPE OBJECT DATABASE

Amos Latteier amos@aracnet.com
Mon, 28 Dec 1998 11:38:20 -0800


At 10:35 AM 12/28/98 -0600, Theodore Patrick wrote:

>HERE IS MY QUESTION(Q:) AND POINT(P:) 
>
>Q:CAN ZOPE STORE DATA AS PROPERTIES OF A FOLDER?

Yes.

>Q:CAN THIS HAPPEN DYNAMICALLY? (a.Create objects b.Store Form data to
>objects c.Refer to Objects)

Yes.

>P:IF YES: THEN YOU DO NOT NEED A DATABASE(in most/some cases-Depending on
>the APP)!

I'm not sure what you mean by this. It's true that Zope's object store
alleviates the need for a RDBMS for many simple scenarios.

>SCENARIO
>   
>    1. User Logs on to a site made of ZOPE.
>    2. User fills out form full of data on the user. FORM
>DATA=(username=monty,dog=rover,shoes=yes,picture=me.gif)
>    3. Zope creates a new user record object --> user_recs.monty
>    4. Zope attaches all of the form data to the object as properties so
>that:
>        a. user_recs.monty.dog = rover
>        b. user_recs.monty.shoes = yes
>        a. user_recs.monty.picture = me.gif
>    5. To GET data simply refer to object property and Data Appears. DING!

This is a pretty reasonable scenario. If you are doing a lot of this kind
of work, you might want to dig more deeply into Zope internals and work
with External Methods for example to have more control over how this sort
of thing works.

>Objects in Zope  vs.  Objects in Python ??? (OBJECT CREATION, PROPERTY
>ALLOCATION, AND PERSISTENCE)
>
>DO OBJECTS GET CREATED SIMPLY BY SETTING THEM TO A VALUE?

I'm not sure what you mean by this, but I'm tempted to say yes...

>IN DTML:
>    user.dogs.fred.john = 1

This is not legal DTML. DTML requires that you call methods, or evaluate
expressions. DTML is not Python. If you want to operate Zope with pure
Python, you need to explore External Methods, and/or the Product API.

>Have I created a PERSISTENT OBJECT IN ZOPE?
>Have I created New Folders?ie;
>    [john(property)=1] inside [fred(object-folder)] inside
>[dogs(object-folder)] inside [user(object-folder)]
>How would I do this in ZOPE DTML?

If you want to create a new folder or property in DTML you need to call
special Zope methods. You can find out about those methods in the online
Zope object reference.

For more information about using Zope, check out the DTML users guide and
the programmer's reference area on the Zope site.

http://www.zope.org/Documentation/Guides

http://www.zope.org/Documentation/Reference

Hope this helps.

-Amos