[Zope-dev] Re: [ZPT] accessing object attributes from python expression raises error

Chris McDonough chrism@zope.com
Tue, 08 Jan 2002 19:53:46 -0500


> meta_type is an attribute, so you can't just do
> 
> security.declareProtected(ACCESS_CONTENTS_PERM, 'meta_type')

That's right.

> The id attribute has the getId method, perhaps what's required is a
> getMetaType method that can be suitably protected?
> 
> This would still be a pretty easy fix:
> 
>     security.declareProtected(ACCESS_CONTENTS_PERM, 'getMetaType')
>     def getMetaType(self):
>         """ """
>         return self.meta_type
> 
> Am I missing something?

Nope, that would work.  But I think also:

meta_type__roles__ = None

.. as a class attr would work as well.

I'll try it and let you know if it works.
-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"