Am Dienstag, den 04.04.2006, 11:24 -0500 schrieb David Johnson:
> I am reading a decimal field from a database and trying to display it
> in a page template. What is the TAL to do this? 
> Among other things, I’ve tried:
> <div tal:replace="python: u'%f' % (item.price)" />
> Which generates the follow exception:
> ForbiddenAttribute: ('__float__', Decimal("0.00"))
> I’ve also tried the simple:
> $<div tal:replace="item/price" />
>  Which displays:
> $<security proxied decimal.Decimal instance at 0x41d76694>


in current Zope versions python decimals are security proxied.
(See also )

I think a better solution than the one described in the bug is the

Write an interface IDecimal which includes alle the mehtods you want to
access in views and page tempates.

Put the following into your configure.zcml:

<class class="decimal.Decimal">
    <implements interface=".interfaces.IDecimal" />
    <allow interface=".interfaces.IDecimal" />

It declares that the class decimal.Decimal implements your IDecimal
interface and that there are no security restrictions on the interface.


Zope3-users mailing list

Reply via email to