[Zope3-Users] How do I get the value of security proxied attributes from a view template

Adam Groszer agroszer at gmail.com
Sat Aug 25 08:56:38 EDT 2007


Hello Yuan,

Try to add some security declaration to decimal.Decimal instead of
using removeSecurityProxy.
something like this (untested):
  <class class="decimal.Decimal">
    <require
        permission="zope.Public"
        attributes="..."
        />
  </class>


Saturday, August 25, 2007, 1:59:26 PM, you wrote:

> On 8/24/07, Andreas Reuleaux <reuleaux at web.de> wrote:


>> from zope.security.proxy import removeSecurityProxy
>>
>> price=removeSecurityProxy(proxiedPrice)
>>
>>

> Yes, it works fine. Thanks.

> However it would mean that I have to add a view class to all my
> objects which contains a decimal attribute, and add
> removeSecurityProxy to all decimal attributes that I wish to present
> through the web? That would be too much unnecessary duplicate code,
> since I am trying to build a web shop with Zope3, in which the decimal
> type is almost everywhere.

> I read in several places that the Security Proxy is supposed only to
> wrap mutable objects. Integer and float for example shall not to be
> proxied. But a decimal.Decimal is also immutable,  why is it  wrapped
> then?

> Is there an easier way to go around this, like to tell security proxy
> not to wrap all decimal objects?

-- 
Best regards,
 Adam                            mailto:agroszer at gmail.com



More information about the Zope3-users mailing list