[Zope] Adding new product in Zope - creating file in subfolder problem

Lubos Culen mirsoft@gmx.net
Thu, 13 Mar 2003 10:09:32 +0100


Hello!

A simple problem: I'd to create new object, which will inherit the Zope 
'Folder' behavior and inside the folder will create some 'content' DTML 
document (or other document type), which I can edit. I followed these 
steps:

I have created new product (let's call it 'New product' and new ZClass 
inside it (let's call it 'New object'). For 'New object', I used base 
classes 'ZClasses: Object Manager' and 'OFS: Folder', so now it inherits 
all folder behavior right (it can contain files, etc.). Now it creates 
successfully my new object as a folder, but I want to copy the default 
"content" file inside it automatically. I created some DTML document called 
"template" inside "New product" folder in Zope products, and I want modify 
the "new_object_add" Python script, to do this:

- copy the "template" file to file "content" inside the "New object" folder
- run some editing onto this "content" file, so user can edit it.

I know I need to add something to "new_object_add" python script, but I 
don't know how, because using "context.manage_clone(container.template, 
instance.content) " (slightly modified step from the Chapter 14 in Zope 
book) doesn't work when creating object inside the Folder. Can anybody 
help?

Thanks a lot for any answer!

-- 
Regards, Mirsoft