Thanks, I will follow up on this.
I did find that the following worked as an interim fix. In my "select"
statement, instead of "select price", we use "select format(price,2) price":
it breaks the i18n stuff but it works otherwise. IDecimal sounds like a much
> -----Original Message-----
> From: Michael Howitz [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 05, 2006 1:36 AM
> To: David Johnson
> Cc: firstname.lastname@example.org
> Subject: Re: [Zope3-Users] TAL and Decimals
> 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 http://www.zope.org/Collectors/Zope3-dev/543 )
> 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