[Zope-dev] Building a WebDAV capable product: how?
Raymond Penners
raymond@duologix.nl
Fri, 05 Oct 2001 17:03:49 +0200
At work, we are seriously considering using Zope. For the Web front-end,
we are already sold. However, for our use, we will heavily rely on its
WebDAV services. We'll need to do some special tricks, so that legacy
systems and Zope interoperate nicely.
As a test case, I wanted to see what it takes to create a special
product, that appears as a directory in webdav, offering some dummy
objects. I want to do this programmatically, not using ZClasses, nor
using the Zope management interface. For my test case, I really just
want to (ab)use Zope's WebDAV server functionality.
Using the "A minimal product HOWTO", and inheriting from
webdav.Collection a webdav directory appeared quickly. However, I am a
bit stuck at figuring out how to get some dummy objects in there.
Modifying the "self._objects" doesn't seem to help, and any
documentation on the ObjectManager, and how it relates to FTPList/WebDAV
is rather sparse.
What I have so far is appended below.
Thanks for any Zenlightenment!
--8<--8<--8<--8<--8<--8<--8<--8<
from OFS import *
import webdav
import OFS
from OFS import FTPInterface
class duologix(
webdav.Collection.Collection,
SimpleItem.Item,
ObjectManager.ObjectManager,
FTPInterface.FTPInterface
):
"duologix object"
meta_type = 'duologix'
isPrincipiaFolderish=1
def __init__(self, id):
"initialise a new instance of Duologix"
self.id = id
def index_html(self):
"used to view content of the object"
return '<html><body>Hello World</body></html>'
def manage_addDuologix(self, RESPONSE):
"Add a Duologix to a folder."
self._setObject('duologix_id', duologix('duologix_id'))
RESPONSE.redirect('index_html')