[Zope3-dev] Re: Does WebDAV work on X3 Beta1?
Joachim Werner
zope at iuveno-net.de
Wed Jun 30 07:01:59 EDT 2004
Hi!
Philipp von Weitershausen wrote:
>> True. But in Zope 2 times one usually asked on the list first. This
>> might be a bug or just a configuration issue. So why should I file a
>> collector issue first?
> Because an KeyError raised clearly is a bug. I would maybe count a
> ComponentLookupError into configuration issues, but definitely not an
> error like that.
I see.
> I'm *pretty* sure that that is due to zope.app.dav.interfaces.IDAVSchema
> lacking a schema field for 'executable'. The
> zope.app.dav.adapter.DAVSchemaAdapter implements IDAVSchema and also has
> an executable method, so I guess it's just a matter of adding this field
> to one of the schemas that IDAVSchema derives from. Would anyone with
> decent DAV knowledge know which one?
You are right. I just came to the same conclusion. If I add the field to
IDAVSchema things work fine. I can have a look at the WebDAV specs later
to find out where it belongs to.
But I think this is a more general bug. At least the error message is
not what I'd expect. What if a client asks for some other attribute
that's not in the schema? Would that mean that the request breaks, too?
If the client does something that's not within the specs there should be
a telling error message (like "This is not a valid WebDAV request!"). If
it is within the specs Zope should do the right thing (which might be
ignoring the attribute in many cases).
Stephan, do you know more about this?
> I actually tried to reproduce your error and I couldn't. You didn't
> really say WHAT exactly you did... Seems like you pointed Konqueror at
> your Zope instance and I have no idea what kind of DAV commands
> Konqueror issues. Maybe you can use Shane Hathaway's TCPWatch and give
> us a more detailled explanation of what it was that your DAV client sent
> and made Zope3 crash. We can then use that to write a test to ensure
> this won't happen again.
Yes, it was Konqueror. I'll double-check with Windows Webfolders, too.
Unfortunately unit tests are my weak point. Even more with things like
WebDAV. OTOH I think there are test suites for WebDAV in general that
could be run against Zope ...
> Anyway, when I was trying to reproduce your problem, I stumbled upon a
> different one. In my root folder, there's an object sitting that
> *doesn't* provide IAnnotatable. For annotatable objects, the
> zope.app.dublincore.annotatableadapter.ZDCAnnotatableAdapter is used to
> feed dublincore metadata to DAV clients. For my object, it was
> surprisingly finding an adapter, but obviously not that one. It found
> zope.app.pagetemplate.talesapi.ZopeTalesAPI, which, too, tries to adapt
> to IZopeDublinCore. If that fails (which it obviously does for my
> non-annotatable object), it raises AttributeError.
>
> So, I was getting an AttributeError for 'modified' when I tried to an
> 'ls' in cadaver. The problem lies in the following lines
> (Zope3/src/zope/app/dav/adapter.py)::
>
> def getlastmodified(self):
> value = IDCTimes(self.context).modified
> if value is None:
> return ''
>
> This code makes the assumption, that you can *always* get an adapter to
> IDCTimes. ITALESAPI includes IDCTimes, that's why I got the ZopeTalesAPI
> adapter for my object, which, however, raised an AttributeError because
> my object wasn't annotatable after all...
>
> So, we should probably
>
> a) make the above code still work if IDCTimes adapter can't be found and
>
> b) only register the ZopeTalesAPI adapter for annotatable objects
>
> Comments?
Yes, I came accross this one (or at least a very related one) yesterday
(second day using Zope X3, so please be patient with me ;-)). If I use
objects that don't implement IAnnotatable I get errors in FTP as well as
in WebDAV.
Here is an example (using a Boring object in the root folder):
The client is Konqueror via FTP:
2004-06-30T12:57:23 ERROR SiteError None
Traceback (most recent call last):
File "/opt/ZopeX3/lib64/python/zope/publisher/publish.py", line 138,
in publish
result = publication.callObject(request, object)
File "/opt/ZopeX3/lib64/python/zope/app/publication/ftp.py", line 38,
in callObject
return mapply(getattr(view, method), (), request)
File "/opt/ZopeX3/lib64/python/zope/publisher/publish.py", line 113,
in mapply
return debug_call(object, args)
File "/opt/ZopeX3/lib64/python/zope/publisher/publish.py", line 119,
in debug_call
return object(*args)
File "/opt/ZopeX3/lib64/python/zope/app/ftp/__init__.py", line 70, in ls
return [lsinfo(name, dir[name]) for name in dir]
File "/opt/ZopeX3/lib64/python/zope/app/ftp/__init__.py", line 77, in
_lsinfo
info = {'name': name,
File "/opt/ZopeX3/lib64/python/zope/app/ftp/__init__.py", line 123,
in _mtime
dc = IZopeDublinCore(file)
File "/opt/ZopeX3/lib64/python/zope/interface/interface.py", line
681, in __call__
raise TypeError("Could not adapt", obj, self)
TypeError: ('Could not adapt', <boring.boring.Boring object at
0x2a98665cf8>, <InterfaceClass
zope.app.dublincore.interfaces.IZopeDublinCore>)
And this is what I get via WebDAV:
2004-06-30T12:59:37 ERROR SiteError http://gozinto:8080
Traceback (most recent call last):
File "/opt/ZopeX3/lib64/python/zope/publisher/publish.py", line 138,
in publish
result = publication.callObject(request, object)
File "/opt/ZopeX3/lib64/python/zope/app/publication/http.py", line
41, in callObject
return mapply(ob, request.getPositionalArguments(), request)
File "/opt/ZopeX3/lib64/python/zope/publisher/publish.py", line 113,
in mapply
return debug_call(object, args)
File "/opt/ZopeX3/lib64/python/zope/publisher/publish.py", line 119,
in debug_call
return object(*args)
File "/opt/ZopeX3/lib64/python/zope/app/dav/propfind.py", line 169,
in PROPFIND
self._depthRecurse(ms)
File "/opt/ZopeX3/lib64/python/zope/app/dav/propfind.py", line 188,
in _depthRecurse
value = pfind.PROPFIND()
File "/opt/ZopeX3/lib64/python/zope/app/dav/propfind.py", line 121,
in PROPFIND
value = attr()
File "/opt/ZopeX3/lib64/python/zope/app/dav/adapter.py", line 43, in
creationdate
value = IDCTimes(self.context).created
File "/opt/ZopeX3/lib64/python/zope/app/pagetemplate/talesapi.py",
line 52, in created
raise AttributeError, 'created'
AttributeError: created
10.10.1.74 - zope.anybody [30/Jun/2004:12:59:37 +0200] "PROPFIND /
HTTP/1.1" 500 308 "" "Mozilla/5.0 (compatible; Konqueror/3.2; Linux)
(KHTML, like Gecko)"
> P.S.: I'm not an expert in DAV. I don't understand the tests well,
> especially test_propfind. I see getlastmodified being used in
> test_propfind, but it doesn't seem to be called. Fact is that we don't
> test this behaviour at all right now.
Same with me :-(
Cheers
Joe
More information about the Zope3-dev
mailing list