[Zope3-Users] Two content objects' simultaneous adding

Ron Bickers rbickers-list-zope3 at logicetc.com
Mon May 22 20:49:18 EDT 2006


On Mon May 22 2006 20:11, Tom Dossis wrote:

> > Ok.  So now I'm wondering... what's the point in using createObject if I
> > can just create an object the Python way?
>
> I guess createObject could be useful in an example such as a generic
> add-objects menu.  In this scenario it's probably be easier to deal with
> factory names.
> Otherwise I can't see why you shouldn't do it the python way if it's
> more direct/explicit.

So is it true then, if I have a class:

class MyObject(object):
    ...

And a factory defined in ZCML:

<class class=".MyObject">
  <factory
      id="me.MyObject"
      description="Create a new MyObject"
      />
</class>

MyObject() and createObject("me.MyObject") will do the same thing and create 
the same object?

If I recall from Zope 2 development, you couldn't just do the former, but 
it's been awhile and I remember just enough to taint my mind when working in 
Zope 3.

Thanks!

-- 
Ron


More information about the Zope3-users mailing list