[Zope-dev] Product construction question
Joost van Lawick
Joost van Lawick <joost@lawick.nl>
Thu, 19 Sep 2002 17:10:26 +0200
----- Forwarded message from zope-dev-request@zope.org -----
Date: Thu, 19 Sep 2002 10:56:07 -0400
Subject: Mailman results for Zope-Dev
From: zope-dev-request@zope.org
To: joost@lawick.nl
Hi,
I have some problems with creating folders and objects.
PF is a Folderish class. This is the add function (or manage_add):
def addPF(self, id=None, title=None, usercontract=None):
"""
Create a portfolio
"""
if not id:
id = uuidgen()
p = PF(id, title, usercontract)
self.Destination()._setObject(id, p)
# create an account
p.addAccount(id='account', valuta='EUR')
p.manage_addFolder(id='KKK')
return id
Now I have the same type of construction for an Account class which is a
SimpleItemish class :
def addAccount(self, id=None, title=None, valuta=None):
"""
Create an user Account
"""
if not id:
id = uuidgen()
p = Account(id, title, valuta)
1: #self.Destination()._setObject(id, p)
2: self._setObject(id, p)
return id
When I comment in line 1 and leave out line 2, I get an Attribute Error on
Destination. When line 1 is commented out and 2 goes in: Voila!
I can still create Account objects in the ZMI.
So what does the Destination() method do in construction of an
object?
Cheers,
Joost
--
Joost van Lawick
E: joost@lawick.com
W: http://www.lawick.com/
--
Joost van Lawick
E: joost@lawick.com
W: http://www.lawick.com/