Re: [Modeling-users] type('') and unicode
Status: Abandoned
Brought to you by:
sbigaret
From: Yannick G. <yan...@sa...> - 2003-07-16 19:52:08
|
=2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On July 16, 2003 03:35 pm, Sebastien Bigaret wrote: > [...] > The first traceback you gave was referring to db_error(), and it would > be interesting to see what kind of errors this was, wouldn't it ?-) Sure ! Couldn't evaluate expression SELECT t0.gl_id, t0.account, t0.control_acct, t0.uom_id, t0.acct_type, t0.is_active, t0.gvt_code FROM GL t0 WHERE (t0.is_active <> -255 AND t0.account LIKE '%=C3=A9=C3=A9%' AND t0.gvt_code = LIKE '%%'). Reason: exceptions.UnicodeError:ASCII encoding error: ordinal not in range(128) Traceback (most recent call last): File "belugaerp/modules/gl/GLModule.py", line 302, in ? mod.getGLAccountWithSpec( spec ) File "/home/ygingras/BelugaERP/belugaerp/modules/gl/GLAccountManager.py", line 62, in getGLAccountWithSpec recs =3D self.getRecsWithSpec(recSpec) File "/home/ygingras/BelugaERP/belugaerp/modules/gl/I18NedManager.py", li= ne 113, in getRecsWithSpec recs =3D self._mainManager.getRecsWithSpec(recSpec) File "/home/ygingras/BelugaERP/belugaerp/modules/gl/SimpleManager.py", li= ne 104, in getRecsWithSpec recs =3D self._mm.fetch(self._tableName, qual) File "/home/ygingras/BelugaERP/belugaerp/modules/gl/ModelManager.py", line 55, in fetch self.__ec.fetch(entName, qualifier, rawRow=3Draw) ) File "/usr/lib/python2.2/site-packages/Modeling/EditingContext.py", line 1304, in fetch return self.objectsWithFetchSpecification(fs) File "/usr/lib/python2.2/site-packages/Modeling/EditingContext.py", line 1218, in objectsWithFetchSpecification objects=3Dself.parentObjectStore().objectsWithFetchSpecification(fs, ec) File "/usr/lib/python2.2/site-packages/Modeling/ObjectStoreCoordinator.py= ", line 420, in objectsWithFetchSpecification return store.objectsWithFetchSpecification(aFetchSpecification, anEditingContext) File "/usr/lib/python2.2/site-packages/Modeling/DatabaseContext.py", line 1521, in objectsWithFetchSpecification anEditingContext) File "/usr/lib/python2.2/site-packages/Modeling/DatabaseChannel.py", line 381, in selectObjectsWithFetchSpecification entity) File "/usr/lib/python2.2/site-packages/Modeling/DatabaseAdaptors/AbstractDBAPI2A= daptorLayer/AbstractDBAPI2AdaptorChannel.py", line 297, in selectAttributes raise GeneralAdaptorException, msg Modeling.Adaptor.GeneralAdaptorException > > Indeed it does the job but as it was discussed some time ago on the > > mailling list, it does not enable case insensitive match. A case > > insentivice match with u"=E9=E9" encoded in utf-8 with look for "=C3=A9= =C3=A9", > > "=E3=A9=C3=A9", "=C3=A9=E3=A9" and "=E3=A9=E3=A9" wich does not make an= y sens once put back in > > unicode. "=E9=E9", "=C9=E9" and "=C9=C9" are respectivly "=C3=A9=C3=A9= ", "=C3=C3=A9" and "=C3=C3" > > once encoded. > > > > So it may be wise to let the user make the utf-8 trick. That way he > > won't blame you for the weird result of case insensitive match. On > > the other hand, some databases like Postgresql detect encoding and > > perform a descent case insitive match with utf-8 data. > > This needs investigation. If some of you could provide working python > code with unicode and psycopg/pypgsql/pgdb/mysqldb/sqlitedb, please > share. I've not time for this now. I'll see what I can do but unicode support is not with MySQL 4.0, it's with 4.1 which is still alpha... http://www.mysql.com/doc/en/Nutshell_4.1_features.html > However, speaking of case-insensitive match: if postgresql supports it, > then it should work, since the SQL WHERE clause behind is UPPER(...) > LIKE UPPER(...) --pure theory and not tested, so if someone feels like > testing it, go ahead :) No Postgresql here to make tests but I'd like to here from people who try this. =2D -- Yannick Gingras Byte Gardener, Savoir-faire Linux inc. (514) 276-5468 =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/FazVrhy5Fqn/MRARAqAUAJ0SwSixlHmhhuOErxYXDuZysIIGzACeL1Of 2BNxeUHeD5Alby920C6agcY=3D =3DP81O =2D----END PGP SIGNATURE----- |