Re: [SQLObject] troubles with unicode

2012-02-26 Thread Oleg Broytman
On Sun, Feb 26, 2012 at 09:00:37AM +0100, Petr Jake?? wrote: > The *names* list generated in: > names = [self.sqlmeta.columns[v[0]].dbName for v in setters] > (_SO_finishCreate method in main module) > > contains unicode type string elements (column names) for the columns, that > are not manually

Re: [SQLObject] troubles with unicode

2012-02-26 Thread Petr Jakeš
> > > sqlobject.dburi="firebird://user:password@localhost > > :3050/pathToTheDatabase/automaty.fdb?charset=utf8" > > > Finally, it looks I was focused on the column values to much, when hunting mentioned UnicodeDecodeError. You can find the solution here: The *names* list generated in: names = [se

Re: [SQLObject] troubles with unicode

2012-02-25 Thread Oleg Broytman
On Sat, Feb 25, 2012 at 07:10:51PM +0100, Petr Jake?? wrote: > sqlobject.dburi="firebird://user:password@localhost > :3050/pathToTheDatabase/automaty.fdb?charset=utf8" FirebirdConnection should rename or alias ``charset`` to ``dbEncoding``. Adding it to my TODO... Oleg. -- Oleg Broytman

Re: [SQLObject] troubles with unicode

2012-02-25 Thread Petr Jakeš
> > > Do you have any idea how to force SQLObject to use the utf-8 instead of > "ascii" for decoding? > I think I have found something. I have an other table, where inserting encoded string works. The only difference between these two tables is the field charset definition. Inserting encoded str

Re: [SQLObject] troubles with unicode

2012-02-25 Thread Petr Jakeš
> It seems your DB API adapter (kinterbasedb) returned unicode values. > StringCol tried to encode them to strings in dbEncoding (ascii) and > failed. Perhaps you have to set a proper dbEncoding. SQLObject 1.1 can > set one encoding per table or per connection. > > Hmmm... the unicode type string c

Re: [SQLObject] troubles with unicode

2012-02-25 Thread Oleg Broytman
On Fri, Feb 24, 2012 at 10:33:34AM +0100, Petr Jake?? wrote: > File > "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/main.py", > line 1130, in _SO_selectInit > colValue = col.to_python(colValue, self._SO_validatorState) > File > "/usr/lib/python2.5/site-packages/SQ

Re: [SQLObject] troubles with unicode

2012-02-24 Thread Petr Jakeš
After some investigation of the method columnsFromSchema it looks like Firebird (FB 2.5 SuperServer actualy) returns the information about the field type in following form: > u'SHORT > ' > so it is necessary to add > t = t.strip() > in the for loop (tested) > > Anyway, I guess it cant hurt anythin

Re: [SQLObject] troubles with unicode

2012-02-24 Thread Petr Jakeš
> By extending method guessClass. > > Oleg, I have generated the test tablefor the Firebird 2.5 database. Than using the SQL select I have found on the web, I have queried fields metadata. Details here

Re: [SQLObject] troubles with unicode

2012-02-23 Thread Oleg Broytman
On Thu, Feb 23, 2012 at 07:50:33PM +0100, Petr Jake?? wrote: > BTW I have found with some luck the FLOAT type is not detected properly. > u'FLOAT' is recognized as > > How to solve this? By extending method guessClass. Oleg. -- Oleg Broytmanhttp://phdru.name/p..

Re: [SQLObject] troubles with unicode

2012-02-23 Thread Oleg Broytman
On Thu, Feb 23, 2012 at 07:40:54PM +0100, Petr Jake?? wrote: > After some investigation of the method columnsFromSchema it looks like > Firebird (FB 2.5 SuperServer actualy) returns the information about the > field type in following form: > u'SHORT > ' > so it is necessary to add > t = t.strip() >

Re: [SQLObject] troubles with unicode

2012-02-23 Thread Petr Jakeš
After some investigation of the method columnsFromSchema it looks like Firebird (FB 2.5 SuperServer actualy) returns the information about the field type in following form: > u'SHORT > ' > so it is necessary to add > t = t.strip() > in the for loop (tested) > > BTW I have found with some luck the

Re: [SQLObject] troubles with unicode

2012-02-23 Thread Petr Jakeš
On 31 January 2012 18:28, Petr Jakeš wrote: > That's ok. "fromDatabase" schema guessing in SQLObject is a bit >> primitive. It works slightly better for The Big Three (MySQL, Postgres, >> SQLite) but still far from ideal. >> You have a chance to improve the machinery for Firebird - it is in >

Re: [SQLObject] troubles with unicode

2012-01-31 Thread Oleg Broytman
Hi! On Tue, Jan 31, 2012 at 06:28:23PM +0100, Petr Jake?? wrote: > With some luck I will check it this weekend (I can not promiss). Eagerly waiting! > It looks > like it gives different results with different versions of Firebird. > Actually I am trying to migrate TurboGears working applicati

Re: [SQLObject] troubles with unicode

2012-01-31 Thread Petr Jakeš
> That's ok. "fromDatabase" schema guessing in SQLObject is a bit > primitive. It works slightly better for The Big Three (MySQL, Postgres, > SQLite) but still far from ideal. > You have a chance to improve the machinery for Firebird - it is in > FirebirdConnection class, methods columnsFromSch

Re: [SQLObject] troubles with unicode

2012-01-30 Thread Oleg Broytman
On Mon, Jan 30, 2012 at 02:23:56AM +0100, Petr Jake?? wrote: > It was necessary to define all the column names and column types manually > in the table Class definition. That's ok. "fromDatabase" schema guessing in SQLObject is a bit primitive. It works slightly better for The Big Three (MySQL

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Petr Jakeš
Finally some small success... It was necessary to define all the column names and column types manually in the table Class definition. Before inserting/updating to the database it is necessary to check, if the inserted value type is the same as declared in the table Class definition (it is not p

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Petr Jakeš
> > = set method start === > > telKontaktniOsoby +420734803579 > > kontaktniOsobaPrijmeni Zburn??k > > nazevKontaktMistaPoruchy recepce > > > > _SO_update start = > > tel_kontaktni_osoby +420734803579 > > kontaktni_osoba_prijmeni Z

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Oleg Broytman
On Sun, Jan 29, 2012 at 11:17:09PM +0100, Petr Jake?? wrote: > File > "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py", > line 329, in _executeRetry > return cursor.execute(query) > UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in > po

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Petr Jakeš
I thing I am few steps farther but new problem arised: File "/TG_web/fantomas/controllers.py", line 305, in ulozeniProdejnihoMista prodMisto.set(**slovnikArgumentu) File "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/main.py", line 1123, in set self._connection

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Petr Jakeš
> > > .set() converts fields to backend format using validators attached to > the fields. UnicodeColumns are encoded to strings, but StringColumns are > not, so when you've assigned a unicode object to a StringCol > ._SO_update() received that unicode object which is wrong - > ._SO_update() has t

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Oleg Broytman
On Sun, Jan 29, 2012 at 09:50:01PM +0100, Petr Jake?? wrote: > = set method start === > telKontaktniOsoby +420721870631 > kontaktniOsobaPrijmeni Kra??mar > nazevKontaktMistaPoruchy Vr??tnice [snip] > _SO_update start = > tel_kontaktni

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Petr Jakeš
> The error means there is at least one 8-bit str mixed with unicode. > If you are sure all values are str instances - what about dbNames? > _SO_update is called from set with dbNames from sqlmeta.columns: > >args = [(self.sqlmeta.columns[name].dbName, value) >

Re: [SQLObject] troubles with unicode

2012-01-29 Thread Oleg Broytman
Hello! On Sun, Jan 29, 2012 at 11:06:31AM +0100, Petr Jake?? wrote: > File > "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/main.py", > line 1120, in set > self._connection._SO_update(self, args) > File > "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.eg

[SQLObject] troubles with unicode

2012-01-29 Thread Petr Jakeš
I am lost, trying to find solution whole night long. all attempts to call the set method (see bellow) are finishing: Page handler: > Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 121, in _run self.main()