[PEAK] A few peak.web bugs

Phillip J. Eby pje at telecommunity.com
Fri Nov 21 09:51:18 EST 2003

At 12:14 PM 11/21/03 +0100, Radek Kanovsky wrote:
>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/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.

Both of these are now fixed in CVS.  Thanks.

>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.

I'm not sure if this is a bug or feature, either.  :)  The root of 
publication is always the 'skin' object, which allows traversing to 
resources via /++resources++.  As a side effect, it is not adaptable to 
IWebPage, even if the application root is.

I've made a tentative fix for this, by giving Skin a getObject() method 
that delegates to the root object's getObject() method.  Let me know if 
this works.  Thanks.

More information about the PEAK mailing list