Hello,
I had some code working on version 0.5 and updated to 0.6
to get advantage of "get()", etc. But alas, the old code isn't working=20
anymore.
Could someone please tell me what should I do to fix it?
The class is:
class Unit(SQLObject):
_connection=3Dconn
_style =3D Style()
_idName =3D "FABRICATION_NO"
_fromDatabase=3DTrue
and some test code works fine with the class:
all =3D Unit.select('all')
el =3D all[0]
fields =3D [(c.kw['name'], getattr(el, c.kw['name'])) for c in el._column=
s]
# >>> fields
#('NAME', None), ('SITE_NAME_1', ''), ('SITE_NAME_2', None),
#('FABRICATION_NO', '0-9787-IDI'), ('DATASOURCE', 'CSd'),
...
Actually, I know that the ID (in this case the field 'FABRICATION_NO')=20
is not
an Integer as required, but since it worked, I let it be (in fact, I=20
cannot have an
incremental as primary key, since this is a legacy database that cannot=20
be touched).
Now, with 0.6, I get the following error:
-----------------
Traceback (most recent call last):
File=20
"C:\PROGRA~2\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptu=
tils.py",=20
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\webware_working\lib\new_code\test_sqlObject.py", line 67, in ?
el =3D all[0]
File "C:\PROGRA~2\Python23\Lib\site-packages\sqlobject\main.py", line=20
1238, in __getitem__
return list(self.clone(start=3Dstart, end=3Dstart+1))[0]
File=20
"C:\PROGRA~2\Python23\Lib\site-packages\sqlobject\dbconnection.py", line=20
456, in next
obj =3D self.select.sourceClass.get(result[0],=20
selectResults=3Dresult[1:], connection=3Dself.dbconn)
File "C:\PROGRA~2\Python23\Lib\site-packages\sqlobject\main.py", line=20
338, in get
id =3D cls._idType(id)
ValueError: invalid literal for int(): 0-9787-IDI
-------------------
I see what the error means, but why it worked before? I was hoping with=20
0.6 for something =E0 la:
Unit.get('0-9787-IDI')
but that is probably wishing to much for the moment, isnt'it?
Should I probably stay with 0.5, or can I somehow change the code in=20
order to work?
thanks and regards,
Eni
|