Re: [Modeling-users] SQLite, problemas with Floats
Status: Abandoned
Brought to you by:
sbigaret
From: Ernesto R. <er...@si...> - 2003-09-17 04:33:58
|
Ok, I've tracked down this and see the following issue: In DatabaseContext.py, near line 1540, the following two lines appear: if value and attr.type() =3D=3D 'DateTime': value=3Dattr.convertStringToAttributeType(value) So we only do type conversion if attr.type() =3D=3D 'DateTime' and value = is not empty ??? Is this an optimization? Shouldn't we force a conversion to Python types whenver possible? Should = this work be done by the database layer (perhaps we need custom = conversions depending on the database)? Erny ----- Original Message -----=20 From: "Ernesto Revilla" <er...@si...> To: "modeling-users" <mod...@li...> Sent: Wednesday, September 17, 2003 1:31 AM Subject: [Modeling-users] SQLite, problemas with Floats Hi again (sorry for the attack), I'm using Modeling 0.9-pre15 and sqlite 2.8.6 When I do a fetch for objects with float attributes, these are string = and not float. Say: .... >>> accounts=3Dec.fetch('Account') >>> accounts[0].getAmount() '0.0' I know that sqlite stores everything as strings, but it should be = converted to float in Python, and I don't know where to do this. The = problem is (suppose account has a name): >>> accounts[0].setName('sales') >>> ec.saveChanges() .... Modeling.Validation.ValidationException: Validation for key saldo = failed: - Wrong type Validation for key OBJECT_WIDE_VALIDATION failed: - Validation of object <Conta.Cuenta.Cuenta instance at 0x00DC4FE8> as a = whole failed because although it has been initialised with 0.0 now it is '0.0' (type = string). Thanx in advance, Erny ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Modeling-users mailing list Mod...@li... https://lists.sourceforge.net/lists/listinfo/modeling-users |