[Zope3-dev] simpleTraverse raises NameError?

Stefan H. Holek stefan at epy.co.at
Sun Oct 23 03:12:37 EDT 2005


Hi All,

I use Z3 Page Templates for things non-Zope and have run into  
unexpected NameErrors.

A condition like <tal:block condition="object/non_existing_attr| 
nothing"> does not evaluate to false (nothing) but raises NameError.  
Digging into zope.tales.expressions, I found that simpleTraverse  
raises NameError in case the object at hand does not implement  
__getitem__. Well, my objects don't and I am screwed as a result ;-)

Now I am wondering if simpleTraverse shouldn't raise AttributeError  
instead. I run this by the list because there may be a non-obvious  
(to me) reason to raise NameError, precisely because it is *not*  
included in Undefs.

So, is there or would this qualify as a bug? There is a test that  
seems to point to some use with regard to namespaces, but I don't see  
how this wouldn't work just as well with AttributeError.

Thanks,
Stefan

--
Anything that happens, happens.  --Douglas Adams




More information about the Zope3-dev mailing list