Edit Skins Over Webdav
This How-to applies to:
Any version.
This How-to is intended for:
Integrators, Customizers
Tested With
- Zope 2.7.3
- Mac OS X 10.3.5 (as the webdav client)
What to do
The following script has been hacked together from many sources found googling for PUT_factory. Name it put_factory.py and put it in the Extensions folder of your Zope instance, then add an external method to portal_skins with id PUT_factory module put_factory :
from Products.PythonScripts.PythonScript import PythonScript
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from OFS.DTMLMethod import DTMLMethod
from OFS.Image import Image
from OFS.Image import File
def PUT_factory(self, name, typ, body):
''' Try to guess the right object type
'''
if typ=='text/x-python' or (body and body[0]=='#'):
ob = PythonScript(name)
elif name.endswith('.css'):
ob = DTMLMethod(name, body)
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
Note
You will still lose usable undo history for the objects as on a file save OS X renames the old file, uploads the file as new and finally deletes the renamed old file.
Contributed by Laurence Rowe
Another link
I was going to add that this link http://myzope.kedai.com.my/blogs/kedai/37 helped me quite a bit.
Problems
There was a missing ":" from the above script.
I also had problems adding the external method under portal_skins, but it worked under the zope root node.
I was having the problem that while I could write files there, when I reloaded them, I seemed to get an attribute file. This appeared to solve that problem.