Wednesday, August 15, 2007

WebDAV, cadaver and metadata

Recently I wanted to automate some document management processes against a Plone site and was trying to figure out how to do set the Title property on the newly created objects via WebDAV, using the cadaver command line client. This led me to look a little more closely at how WebDAV does properties. In fact it is not like a simple Python dictionary, rather there is a nested structure like a dictionary of dictionaries. Each application can have its own namespace. By default cadaver will set properties in its own custom namespace. So you need to use the set namespace command to use the Zope namespace identified by its namespace: The following example uses cadaver and creates a collection (folder) and sets the title property:
mkcol just_a_folder
set namespace
propset just_a_folder title “A long title”