[Zope-DB] Extrange behavior with numeric datatypes and decima l places

Smith, Neil (Worcester) Neil.Smith at npower.com
Tue Aug 5 09:38:47 EDT 2003


It's probably just the display format.  In DTML try 

<dtml-var result format="%.2f">

There's probably something similar in ZPT.

-----Original Message-----
From: Luis Mariano Luporini [mailto:lluporini at yahoo.com.ar]
Sent: 04 August 2003 18:24
To: zope-db at zope.org
Subject: [Zope-DB] Extrange behavior with numeric datatypes and decimal
places


Hi list.

I'm having a problem using the following:

- Gentoo Linux
- Zope 2.6.1
- Python 2.1.3
- psycopg 1.1.2
- zpsycopgda 1.1.2
- Postgresql 7.3.3

The situation is I'm trying to get a number (result of a division) 
rounded to two decimal places and can't get it to work.

After some research, my problem can be simplified to this:

If I run the query:

select 3::numeric(10,2)

in psql I get a result of 3.00 (normal and expected behavior)

in zope I get a result of 3.0  (why just one decimal place?)

How can I get around this. Is this a bug in psycopg or something like that?

Anybody experienced this?

Thanks in advance.





_______________________________________________
Zope-DB mailing list
Zope-DB at zope.org
http://mail.zope.org/mailman/listinfo/zope-db


**********************************************************************
 
The information contained in this e-mail is confidential and intended only
for the use of the addressee. If the reader of this message is not the
addressee, you are hereby notified that you have received this e-mail in
error and you must not copy, disseminate, distribute, use or take any action
as a result of the information contained in it.
    
If you have received this e-mail in error, please contact the address below
(UK 01384 275454) and delete it immediately from your system.

postmaster at npower.com
    
**********************************************************************


**********************************************************************
 
The information contained in this e-mail is confidential and intended only for the use of the addressee. If the reader of this message is not the addressee, you are hereby notified that you have received this e-mail in error and you must not copy, disseminate, distribute, use or take any action as a result of the information contained in it.
    
If you have received this e-mail in error, please notify postmaster at npower.com (UK 01384 275454) and delete it immediately from your system.
    
Neither Npower nor any of the other companies in the Innogy group from whom this e-mail originates accept any responsibility for losses or damage as a result of any viruses and it is your responsibility to check attachments (if any) for viruses.
Npower Limited Registered office: Windmill Hill Business Park, Whitehill Way, Swindon SN5 6PB. Registered in England and Wales: number 3653277.  This e-mail may be sent on behalf of a member of the Innogy group of companies.
**********************************************************************




More information about the Zope-DB mailing list