[PEAK] A few peak.web bugs
Radek Kanovsky
rk at dat.cz
Fri Nov 21 06:14:11 EST 2003
Hi all,
playing with peak.web I have noticed some bugs:
1. peak.web.places doesn't import needed WebException
- from errors import NotFound, NotAllowed
+ from errors import NotFound, NotAllowed, WebException
2. accessing attribute that's not explicitely allowed or denied
(via security.allow or otherwise) causes following exception:
File "/usr/local/lib/python2.3/site-packages/zope/publisher/publish.py",
line 135, in publish
object = request.traverse(object)
File "/usr/local/lib/python2.3/site-packages/zope/publisher/browser.py",
line 612, in traverse
ob = super(BrowserRequest, self).traverse(object)
File "/usr/local/lib/python2.3/site-packages/zope/publisher/http.py",
line 435, in traverse
ob = super(HTTPRequest, self).traverse(object)
File "/usr/local/lib/python2.3/site-packages/zope/publisher/base.py",
line 252, in traverse
subobject = publication.traverseName(
File "/usr/local/lib/python2.3/site-packages/peak/web/publish.py",
line 203, in traverseName
return ob.contextFor(name)
File "/usr/local/lib/python2.3/site-packages/peak/web/places.py",
line 95, in contextFor
ob = self.traversable.traverseTo(name, self)
File "/usr/local/lib/python2.3/site-packages/peak/web/skins.py",
line 72, in traverseTo
return self.root.traverseTo(name, ctx)
File "/usr/local/lib/python2.3/site-packages/peak/web/places.py",
line 245, in traverseTo
return super(Decorator,self).traverseTo(name, ctx)
File "/usr/local/lib/python2.3/site-packages/peak/web/places.py",
line 189, in traverseTo
raise NotAllowed(ctx, result.message)
AttributeError: 'bool' object has no attribute 'message'
Here places.Traversable.traverseTo relies on attribute `message'
of object returned from Interaction.allows method. But True/False
is returned sometimes. So `result.message' should be changed
to `getattr(result, "message", "Permission denied")' or such.
3. When I create web application such that its root component directly
implements IWebPage protocol, it has no effect, i.e. render method
is not called. `index_html' is called instead or default skin
instance representation is rendered if index_html is not defined.
I am not sure, if this is not feature. I don't realy need renderable
application root, just noticed that during experiments.
Regards,
RadekK
More information about the PEAK
mailing list