Zope, kde and webdav
by
kedai
—
last modified
Apr. 21, 04 06:11 PM
I've used webdav with zope and kde some times ago, and thought it'd be great if I document the steps so that I don't forget, and hopefully others will benefit from the experience.
Zope came with webdav enabled. KDE supports webdav in all its applications, for example konqueror, quanta, kwrite, etc.
It is only natural to use these applications and use it when developing in zope or plone.
Steps needed to get kde and zope to dance:
- get PUT_factory. add one at our zope root.
name this put_factory.py, and put it in Extensions directory (taken from webdav howto).
from Products.PythonScripts.PythonScript import PythonScript
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from OFS.DTMLDocument import DTMLDocument
from OFS.Image import Image
from OFS.Image import File
def PUT_factory( self, name, typ, body ):
# Gimme a PageTemplate or a PythonScript, but never DTML!
if typ==text/x-python or (body and body[0]==#):
ob = PythonScript( name )
elif typ.startswith(text):
ob = ZopePageTemplate(name, body, content_type=text/html)
elif typ.startswith(image/):
ob = Image(name, '', body, content_type=typ)
else:
ob = File(name, '', body, content_type=typ)
return ob
here's the file.
- go to ZMI and add External Method.
id: PUT_factory
module name: put_factory
function: PUT_Factory
- now we need to enable webdav server at zope. this is zope 2.7, so we need to change items in zopehome/etc/zope.conf
<webdav-source-server>
# # valid keys are "address" and "force-connection-close"
address 8031
# force-connection-close off
</webdav-source-server>
restart zope.
- now, open konqueror, and put this in the location:
webdav://server:8031/
by default, zope 2.7 will disable webdav access to anonymous. for zope use, or plone, enable Member role the ability "webdav access"
- we will then be prompted for id and password. fill in the necessary and we will be greeted with listing of objects in zope.
- editing page template and script python is just a click away. a box will pop up asking for our choice of application. I chose kate, and away we go. Edit, and save. that's it.
- Deleting is also a matter of selecting the objects and clicking delete.
- creating a new document is also easy. If this is done in zope, just go to "Edit, create", and create our document. we can then edit the object. In plone, we need to configure content_type_registry. by default, News Item needs extension .news for plone to recognize that "yes, this is a News Item".
So, to create a News Item in plone, click "edit, create, file, text" and name it something.news. we can now call soething.news, and edit it as necessary. as a matter of fact, this document is done using kate, thru webdav.
Here's a screenshot of konqueror, kate and zope+webdav.
Mind you, this is not the only way to work with zope+webdav. We can start kate, and click open, and put webdav://server:8031/path/to/file, and start editing.
Even better, let's put a link in our directory listing to point to our webdav://server:8031
have fun! I know i did.
should say
function: PUT_factory
lower case