Re: [Modeling-users] Python 2.3 and booleans
Status: Abandoned
Brought to you by:
sbigaret
|
From: Sebastien B. <sbi...@us...> - 2004-04-16 12:25:43
|
Hi Yannick,
Not sure I fully understand what effect you want here, just in case
this can help: you can transform any attribute's value stored as an int
in the db into py2.3 boolean automaticall=3Dy by using a KeyValueCoding
private setter, like that:
def _setMyAttribute(self, value):
self.value=3Dbool(value)
(this is in fact the very same technique exposed here:
http://modeling.sourceforge.net/UserGuide/attribute-custom-type.html)
If it's not what you need, could you also give a little example?
(admittedly I've read your msg quickly and answering the same way...)
and I'll have a look at Arch when I find time ;) Any idea on whether
it wirks on sf?
-- S=E9bastien.
Yannick Gingras <ygi...@yg...> writes:
> Hi,=20
> we just upgraded to Python 2.3. As you probably know, Python 2.3
> now has a boolean type so repr(a =3D=3D b) is no longer 0 or 1 but True or
> False.
>=20
> We use some int(1) in our database to represent booleans but now all
> our queries involving those fields are broken.
>=20
> This is absolutely not a Modeling problem but I think that I can use
> Modeling to reconvert those values just before the query. That would
> solve quite a lot of work here.
>=20
> Any of you guys had the same problem when switching to Python 2.3 ?
>=20
> Should I tweak Modeling to make the conversion automatically ? Can it
> break anything somewhere else ?
>=20
> And absolutely unrelated to this problem, I've been using GNU Arch
> lately instead of CVS. It features GPG signed commits and ease
> maintaining branches in synch. If Modeling used Arch, we could make
> the changes to automate booleans conversions in our branch and still
> stay up to date with the main branch in case someone else would like
> to have this particular feature and Sebastian find our code too ugly
> to be merged yet...
>=20
> ; )
>=20
> Enough propaganda, thanks for your time guys !
>=20
|