[Zope] Python equivalent of dtml-with?
Evan Simpson
evan@digicool.com
Mon, 6 Mar 2000 17:13:51 -0500
----- Original Message -----
From: James W. Howe <jwh@allencreek.com>
> I've got an external method written which is able to create a new object
by
> calling the ZClass.createInObjectManager method. However, I'm not sure
how
> to code up the code contained in the dtml-with block using Python. I
> suspect that I could get things to work for the example above with
> something like this:
>
> (self is the product containing my ZClass definition)
>
> newobj = self.ZClass.createInObjectManager(REQUEST['id'], REQUEST)
> newobj.propertysheets.instanceProperties.manage_editProperties(REQUEST)
> newobj.unindex_object()
> newobj.manage_editCataloger('MyCatalog', REQUEST)
> newobj.index_object()
This looks right.
> However, I'm interested in knowing how do code up stuff in Python which
> would take into account acquisition.
Acquisition is built into Zope objects; the only time you should ever have
to "take [it] into account" is if you are trying to acquire an object with a
non-identifier Id, or whose Id is stored in a variable. In these cases
"anobj.aq_acquire('foo.html')" and "anobj.aq_acquire(fooname)" should do.
Cheers,
Evan @ digicool & 4-am