Dennis Allison writes:
In an External Method (that is, unrestricted python), for example, when you create a Folder one writes:
self.manage_addProduct['OFSP'].manage_addFolder( id,title="folder")
one would think that it would return the object it just constructed so it would be easy to use the new product to, say, create another folder or a file inside. But that appears not to be the case. (In my example, the folder was successfully created but the code
handle = self.manage_addProduct...
returned None. That made what I thought was the obvious way to handle things, namely applying the constructor to the new folder using
handle = self.manage_addProduct...
fails as the constructor returns None. So, how do you get a reference to the newly created object? I agree with you, but returning objects is sometimes not so good in a Web context.
You get the object by using "getattr(container,id)". "container" is the container where you created the object, "id" is its id. Dieter