[Zope3-dev] Nasty bugs

Casey Duncan casey@zope.com
Wed, 20 Mar 2002 16:36:29 -0700


The question then becomes (to me), should we allow primitives to be 
wrapped at all? Maybe the context wrapper should just pass them through 
unchanged.

I can't really see doing security checks on None. I guess I can imagine 
maybe wanting to know the context of None...Hmmm, 
WrappedNone.getPhysicalPath() 8^)

Just thinking out load.

-Casey

Jim Fulton wrote:
> Guido van Rossum wrote:
> 
>>I wondered, "why does the z3 root view display a broken image for
>>Folders?"
>>
> 
> Because icon support hasn't been implemented yet. :) Ditto for the
> "title" part of the display.
>  
> 
>>There's no single answer.  I found several bugs.  I don't know how to
>>fix them.
>>
>>(1) The page template used,
>>    Zope3/lib/python/Zope/App/OFS/Folder/main.pt
>>    contains this text:
>>
>>          <img alt="Folder" src="../../ZMI/www/folder_icon.gif"
>>               tal:condition="info/url"
>>               tal:attributes="src info/url" />
>>
>>    which I believe is a cut-and-paste error, and should really be
>>
>>          <img alt="Folder" src="../../ZMI/www/folder_icon.gif"
>>               tal:condition="info/icon"
>>               tal:attributes="src info/icon" />
>>
> 
> You are right about the typo, however, the ultimate working code
> is likely to look much different. I started adding icon support
> several weeks ago. Among other things, this led to adding resources, 
> since icons are resources.
> 
> For now, we should just take this out of the contents view. I should
> probably hand off my partial icon work to someone else.
> 
> 
> 
>>(2) When I fixed that in my copy, I got a traceback, ending in
>>    "TypeError: len() of unsized object" in method evaluateBoolean()
>>    in class Context in module TALES, file
>>    Zope3/lib/python/Zope/PageTemplate/TALES.py (sorry, lost the lineno).
>>    Casual printing of the evaluation outcome showed that it was doing
>>    "not not None", which shouldn't trigger this error.
>>    Printing of its type showed that it's really a wrapper for None,
>>    and that using it in a Boolean context causes this error.
>>    Two questions come up:
>>
>>    (2a) Why would None need to be wrapped?
>>
> 
> The reason an object would need to be wrapped is if someone wanted 
> to know how it was obtained. There are a number of reasons that
> someone might do that:
> 
>   - To do security Checks, although this doesn't apply to basic objects
>     (whatever they are;), like None and numbers, and strings, that
>     can't have meta-data needed for security checks.
> 
>   - Generating URLs. I suppose we don't want to be able to generate 
>     urls to basic objects.
> 
>   - ???
> 
> What is actually doing the wrapping here? ZPT path expressions?
>  
> 
>>    (2b) Why can't I use a wrapped None in a Boolean context?
>>
> 
> It's a bug, as I think you've figured out.
> 
> ...
> 
> 
>>I could fix the bug in (1), but then the cure would be worse than
>>the problem (you'd get a traceback from the front page instead of a
>>broken image icon).
>>
>>Please advise.
>>
> 
> 1 should be fixed by not showing the icon (or the title) for now. :)
> 
> Jim