Document Library: Changing Properties
hi, I have 108 documents in a Document Library (product). I need to go through them all and set one propertie equal to another. Something like document.x = document.y. I figure this is a good time to learn python scripting in zope. I don't know how to get the documents into my script, then back out. Any help would be appreciated. Thanks, j. -- ...................... ..... Jason C. Leach .. PGP/GPG Public key at http://www.keyserver.net/ Key ID: 157BD48C
Hi Jason, I don't know a thing about Document Library but you can probably acquire it (is it folderish?) It may have some special API for getting documents. You may need to inspect its source to find out. Assuming it's "folderish" you could do something like for doc in context.myDocumentLibrary.objectValues(): doc.manage_changeProperties(y=doc.x) This will change *all* the objects in the folder "myDocumentLibrary". If you want to get only certain meta_types, you can pass in a list of meta_types that you want, e.g., for doc in context.myDocumentLibrary.objectValues('DTML Document'): doc.manage_changeProperties(y=doc.x) anyway... good luck! -steve On Thursday, November 29, 2001, at 02:28 AM, Jason C. Leach wrote:
hi,
I have 108 documents in a Document Library (product). I need to go through them all and set one propertie equal to another. Something like document.x = document.y. I figure this is a good time to learn python scripting in zope. I don't know how to get the documents into my script, then back out.
Any help would be appreciated.
Thanks, j.
-- ...................... ..... Jason C. Leach ..
PGP/GPG Public key at http://www.keyserver.net/ Key ID: 157BD48C
_______________________________________________ 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 )
On Thursday 29 November 2001 02:28 am, Jason C. Leach allegedly wrote:
hi,
I have 108 documents in a Document Library (product). I need to go through them all and set one propertie equal to another. Something like document.x = document.y. I figure this is a good time to learn python scripting in zope. I don't know how to get the documents into my script, then back out.
Any help would be appreciated.
Thanks, j.
Actually you can use the Find tab to do this. There you can enter an expression. Although is is designed so that and expression can be used to find things, it can also be used to execute an expression en masse. Go to the Documents "Folder", click on the find tab. Click on advanced. In the expr field enter something like: manage_changeProperties(foo=bar) Where foo is the name of the property to copy to and bar is the one to copy from. hth, /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/
participants (3)
-
Casey Duncan -
Jason C. Leach -
Steve Spicklemire