On 7 déc, 04:32, Italo Maia <italo.m...@gmail.com> wrote:
> I'm having trouble with buzhug + decimal fields. Is there a way to
> make it work? Using buzhug from ubuntu karmic repository.
For the moment the decimal type is not supported. As for all types,
there must be a function that transforms a value to a string,
preserving the order. I haven't spent much time on it, but with all
the available options for the decimal type I wonder if such a function
can be found. Ideas, anyone ?
- Pierre
- Pierre
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes buzhug.
Pour envoyer un message à ce groupe, adressez un e-mail à buz...@googlegroups.com.
Pour vous désabonner de ce groupe, envoyez un e-mail à l'adresse buzhug+un...@googlegroups.com.
Pour plus d'options, consultez la page de ce groupe : http://groups.google.com/group/buzhug?hl=fr
Possibly the FloatFile class in buzhug_classes.py could be adapted. Here is rough outline:
Copy FloatFile to create a new class called DecimalFile
Put this somewhere convenient:
from decimal import Decimal
In the to_block() method:
...
i = value.to_integral()
j = (value - i) * Decimal('10**9')
Yes but the value stored in the database must compare/sort correctly, which won't happen automatically if a string is saved. You could pad the string with zeroes, but then you have to make a decision on how many significant digits you want to store. The struct value only takes 13 bytes and stores a long for the wholenumber part and nine decimal places for the fraction.