[Zope3-Users] Re: IContainer as IReadFile in WebDav

Michael Kerrin michael.kerrin at openapp.biz
Mon Feb 19 18:19:34 EST 2007


Hi Alek,

Which webdav component are you using. zope.app.dav or zope.webdav?

On Monday 19 February 2007 12:12, Alek Kowalczyk wrote:
> > <adapter for=".interfaces.plot.IPlot"
> >  provides="zope.filerepresentation.interfaces.IReadFile"
> >  factory=".csv.PlotAsCsvFile" permission="zope.Public" />
>
> One small mistake (just here, in my real code it was OK).
> Of course the adapter provides IReadFile, no IReadDirectory).
> I still can't make this to get CSV files instead of folder on WebDAV.
WebDAV doesn't use a IReadFile adapter to access files. WebDAV is just an 
extension to HTTP so you must define the default view for your IPlot object 
to return your CSV file.

In order to tell Excel (I am going to assume this works with Excel but I know 
it works with OpenOffice and other WebDAV clients but I haven't tried it with 
Excel) that your IPlot objects are files - you need to override the 
DAV:resourcetype property and specify a None value for this property. The 
only other WebDAV properties that I think you may also need to change are the 
DAV:getcontenttype and DAV:getcontentlength to their respective values for 
the CSV file.

With zope.webdav it is as easy as writing a multi adapter from (IPlot, 
IHTTPRequest) -> zope.webdav.coreproperties.IDAVResourceType to override the 
DAV:resourcetype propertry and for DAV:getcontenttype you write an adapter 
from (IPlot, IHTTPrequest) -> zope.webdav.coreproperties.IDAVGetcontenttype.

Hope this helps
Michael

-- 
Michael Kerrin

55 Fitzwilliam Sq.,
Dublin 2.

Tel: 087 688 3894


More information about the Zope3-users mailing list