On Thu, 2 May 2002, Dieter Maurer wrote:
Luca Manini writes:
I've a product that defines a classe ageForm. I've a PythonScript that adds an ageForm instance to a folder. After adding the instance it calls a method on it. This methods tries to access an objects using acquisition. ... Apparently, you do not tell us what your problem is...
I expect, the problems cause is that constructors in Zope usually do not return the constructed object (but either "None" or the id of the constructed object).
The standard idiom is:
om.manage_addProduct[<product_name>].<constructor>(id,....) obj= getattr(om,id) I tried it this way and it works perfectly if the new object is a folder or a dtml-document, but not for a tinytable object. A complete very simple example you can find at:
http://www.foodborne-net.de/~tillea/MyFolder/MyFolder.tgz The relevant part is shown here: ob=MyFolder() ob.id=str(id) ob.title=title self._setObject(id, ob) ob=self._getOb(id) checkPermission=getSecurityManager().checkPermission ### From the example ... but does not work anyway ## ob = getattr(self, id) #we basically get the instance from the ZODB, now has AqWrapper ob.manage_addFolder('someid') #works as expected ob.manage_addTinyTable(id='link_table', title='TinyTableObject for '+ob.id, columns=column_names) The last line does not work because it does not put the TinyTable object into the new folder (where I was able to create the example folder named 'someid' but it will be created in the folder below. Is this perhaps a TinyTable bug? Kind regards Andreas.