[Zope] webdav and MSWorddocument or nuxdocument

Einar Nęss Jensen einjen@nvg.ntnu.no
Fri, 28 Feb 2003 08:24:22 +0100


>
>My guess is that this is something that have been tried before.
>Does anyone have a put_factory that works for MSWordDocument?
>ev. what do I write one my selfe?


I think I figured it out myself:

------------------------------
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 in ['doc']:
                 from Products.NuxDocument.ZNuxDocument import ZNuxDocument
                 return ZNuxDocument('', name, body)

         else:
                 from OFS.Image import File
                 return File(name, '', body, content_type=typ)


import webdav.NullResource
webdav.NullResource.NullResource._default_PUT_factory = PUT_factory
------------------------
It works just perfect (at least for now)!!!


I'm starting to fall in love with zope.....

Thanks to everyone!!