programmatically adding documents and properties
Hi, I want to do the following from a Python Script: - create a Folder - create a DTML Document within that folder - add a property to this new DTML Document I've got it all working except the last part. here's my code: --------------------------------------- folder_name = 'test_folder' document_name = 'test_document' context.manage_addFolder(folder_name, 'folder title') f = getattr(context, folder_name) f.manage_addDTMLDocument(folder_name,'document title') ' what to do here? I think it should be: ' f.getattr(context,document_name).manage_addProperty(etc) ' but it's not working print 'done' return printed ----------------------------------------- I'm just having trouble getting the new document object that's just been created. Can someone help? thanks much -Kevin __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Oops I just noticed a type in my message. My code sample should be: --------------------------------------- folder_name = 'test_folder' document_name = 'test_document' context.manage_addFolder(folder_name, 'folder title') f = getattr(context, folder_name) f.manage_addDTMLDocument(document_name,'document title') ' what to do here? I think it should be: ' f.getattr(context,document_name).manage_addProperty(etc) ' but it's not working print 'done' return printed ----------------------------------------- --- Kevin L <kevinsl@yahoo.com> wrote:
Hi,
I want to do the following from a Python Script:
- create a Folder - create a DTML Document within that folder - add a property to this new DTML Document
I've got it all working except the last part.
here's my code:
--------------------------------------- folder_name = 'test_folder' document_name = 'test_document'
context.manage_addFolder(folder_name, 'folder title') f = getattr(context, folder_name) f.manage_addDTMLDocument(folder_name,'document title') ' what to do here? I think it should be: ' f.getattr(context,document_name).manage_addProperty(etc) ' but it's not working print 'done' return printed -----------------------------------------
I'm just having trouble getting the new document object that's just been created. Can someone help?
thanks much
-Kevin
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Nearly there: change: f.getattr(context,document_name).manage_addProperty(... to: getattr(f, document_name).manage_addProperty(.... document_name is a subojbect of f, not context. Cheers. -- Andy McKay. ----- Original Message ----- From: "Kevin L" <kevinsl@yahoo.com> To: <zope@zope.org> Sent: Wednesday, July 25, 2001 4:26 PM Subject: Re: [Zope] programmatically adding documents and properties
Oops I just noticed a type in my message. My code sample should be:
--------------------------------------- folder_name = 'test_folder' document_name = 'test_document'
context.manage_addFolder(folder_name, 'folder title') f = getattr(context, folder_name) f.manage_addDTMLDocument(document_name,'document title') ' what to do here? I think it should be: ' f.getattr(context,document_name).manage_addProperty(etc) ' but it's not working print 'done' return printed -----------------------------------------
--- Kevin L <kevinsl@yahoo.com> wrote:
Hi,
I want to do the following from a Python Script:
- create a Folder - create a DTML Document within that folder - add a property to this new DTML Document
I've got it all working except the last part.
here's my code:
--------------------------------------- folder_name = 'test_folder' document_name = 'test_document'
context.manage_addFolder(folder_name, 'folder title') f = getattr(context, folder_name) f.manage_addDTMLDocument(folder_name,'document title') ' what to do here? I think it should be: ' f.getattr(context,document_name).manage_addProperty(etc) ' but it's not working print 'done' return printed -----------------------------------------
I'm just having trouble getting the new document object that's just been created. Can someone help?
thanks much
-Kevin
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Andy McKay -
Kevin L