[Zope-CMF] Classes whose instances appear in ZODB

2006-03-08 Thread George Lee
If I want a class to appear in the ZODB, is that just a matter of
subclassing SimpleItem?

What additional attributes do I need to set -- for instance, do I need
to define 'meta_type' for the class?

Can a class be persistent but not have its instances appear in the
ZODB -- for instance, does subclassing Persistent do this? (I want to
define two classes, one of which stores instances of the other as an
attribute.)

Thanks; peace,
George
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Classes whose instances appear in ZODB

2006-03-08 Thread Lennart Regebro
On 3/8/06, George Lee <[EMAIL PROTECTED]> wrote:
> If I want a class to appear in the ZODB, is that just a matter of
> subclassing SimpleItem?

Define "Appear"? :-)

Do you mean that you want it to pop up in the Add menu of the ZMI?

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Classes whose instances appear in ZODB

2006-03-08 Thread George Lee
Instances show up in the list of objects in a container (which may be
equivalent to the class showing up in the Add menu?)

Peace,
George


On 3/8/06, Lennart Regebro <[EMAIL PROTECTED]> wrote:
> On 3/8/06, George Lee <[EMAIL PROTECTED]> wrote:
> > If I want a class to appear in the ZODB, is that just a matter of
> > subclassing SimpleItem?
>
> Define "Appear"? :-)
>
> Do you mean that you want it to pop up in the Add menu of the ZMI?
>
> --
> Lennart Regebro, Nuxeo http://www.nuxeo.com/
> CPS Content Management http://www.cps-project.org/
>
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Classes whose instances appear in ZODB

2006-03-08 Thread Lennart Regebro
On 3/8/06, George Lee <[EMAIL PROTECTED]> wrote:
> Instances show up in the list of objects in a container (which may be
> equivalent to the class showing up in the Add menu?)

Nope, that's not equivalent. I'm not exactly sure what the
requirements are. A getId method, a title attribute and a meta_type
probably. Subclassing from SimpleItem is definitely a good idea.

Oh, and you need to add the object to the container, of course. ;)

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Classes whose instances appear in ZODB

2006-03-08 Thread Dieter Maurer
George Lee wrote at 2006-3-8 10:17 -0500:
>If I want a class to appear in the ZODB, is that just a matter of
>subclassing SimpleItem?

Usually, classes do not "appear" in the ZODB -- just their instances.

"SimpleItem" is the base class of all (what I call) Zope site building
objects -- the term "Zope site building object" may correspond to
your "may appear in the ZODB".

Perhaps, you will find reading

  

useful.

>What additional attributes do I need to set -- for instance, do I need
>to define 'meta_type' for the class?

"meta_type" is usually used in the so called "add list".
It should be a unique description of your object class such
that you are able to select the object from the add list
when you need it.

You use "ObjectManager._setObject(id, obj)" to put "obj" into
the "ObjectManager". Note, that you must also give "obj" the identical
"id". Otherwise, URL generation will break.


>Can a class be persistent but not have its instances appear in the
>ZODB

Yes.

You can instanciate a class deriving from "Persistent" without
the instance to actually get persisted. It only gets persisted
when you assign it to an attribute of a persisted object.

You may want to read the ZODB guide.


-- 
Dieter
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Classes whose instances appear in ZODB

2006-03-09 Thread Chris Withers

Lennart Regebro wrote:

Nope, that's not equivalent. I'm not exactly sure what the
requirements are. A getId method, a title attribute and a meta_type
probably. Subclassing from SimpleItem is definitely a good idea.


...appart from the lame-ass "allow by default" security policy it drags 
in along the way :-/


Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests