Edit Skins Over Webdav
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
