[Zope3-Users] Re: How to test for object metatype

Cliff Ford Cliff.Ford at ed.ac.uk
Mon Apr 18 18:10:19 EDT 2005


Thank you: I now have all the filtering code in the browser view class 
and am using providedBy rather than isinstance. The update method 
forbiddenAttribute problem got sorted using setattr(...) instead of 
attribute=...

Cliff

Philipp von Weitershausen wrote:
> Cliff Ford wrote:
> 
>> Thanks for the help. I 'discovered' the isinstance method in the ZAPI 
>> Reference of your book, which is just what I needed.
> 
> 
> Note that with isinstance, you check for a certain implementation, not 
> for functionality. In general, that is not preferrable because 
> implementations may change, interfaces usually don't.
> 
> So, for filtering, it's preferrable to use ISomeInterface.providedBy(obj)
> 
>> I put the filter method in the custom content class rather than a
>> separate view class. It all seems to work so I am progressing again.
> 
> 
> Putting display filtering in a content class is not quite a kosher way 
> to go. You should filter in the browser view.
> 
> Philipp
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


More information about the Zope3-users mailing list