Re: [Zope3-Users] How do I get the value of security proxied attributes from a view template
On 8/24/07, Andreas Reuleaux <[EMAIL PROTECTED]> 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? -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re[2]: [Zope3-Users] How do I get the value of security proxied attributes from a view template
Hello Yuan, Try to add some security declaration to decimal.Decimal instead of using removeSecurityProxy. something like this (untested): Saturday, August 25, 2007, 1:59:26 PM, you wrote: > On 8/24/07, Andreas Reuleaux <[EMAIL PROTECTED]> 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, Adammailto:[EMAIL PROTECTED] ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How
Hi, everyone: In my page template, I would like to show one message if the request is authenticated, and other if the user has not logged in. Is there a simple test I can use in the template file like? Please Log In Hello Mr. XXX Similiar thing used to work with Zope2. But with Zope3, request only has an attribute 'principal', which will return a object. I have seen code doing verification in the view class like this: if (not IUnauthenticatedPrincipal.providedBy(request.principal): ... But surely there will be a much simpler way to do this? -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users