import OFS.Folder import string def PUT_factory( self, name, typ, body ): #print 'PUT_factory called' parts = string.split(name, '.') ext = parts[-1] if ext == 'html': from Products.HTMLDocument.HTMLDocument import HTMLDocument return HTMLDocument('', __name__=name) elif ext in ['pdf']: from Products.PDFDocument.PDFDocument import PDFDocument return PDFDocument('', __name__=name) elif ext in ['doc']: from Products.WORDDocument.WORDDocument import WORDDocument return WORDDocument('', __name__=name) elif ext in ['shtml', 'wshtml']: # Would like to create these as DTMLDocuments, but # since the munger won't parse some SSI, we have to # use File objects #from OFS.DTMLDocument import DTMLDocument #return DTMLDocument(body, __name__=name) from OFS.Image import File return File(name, '', body, content_type=typ) elif string.find(typ, 'image/') >= 0: from OFS.Image import Image return Image(name, '', body, content_type=typ) elif typ == 'text/html': from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate return ZopePageTemplate(name, body, content_type=typ) # elif body[0:17] == 'Wiki-Safetybelt: ': # from Products.ZWiki.ZWikiPage import ZWikiPage # return ZWikiPage('', __name__=name) else: from OFS.Image import File return File(name, '', body, content_type=typ) import webdav.NullResource webdav.NullResource.NullResource._default_PUT_factory = PUT_factory