Re: new code for columnsFromSchema and guessClass methods

Oleg Broytman <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
[Answering to the list.]

On Sat, Feb 25, 2012 at 03:41:59PM +0100, Petr Jake?? wrote:
> It looks like the .set method  (main script) is encoding unicode strings
> cointained in the kw dictionary  (I mean the method is changing <type
> 'unicode'> to <type 'str'>)
> 
> it is happening here:
> kw[name] = dbValue = from_python(value, self._SO_validatorState)
> 
> and I really do not understand what is going on in above mentioned row.

   SQLObject is not really unicode-based, it's at most unicode-aware.
All processing done internally using str. And SQLObject assumes it has
to pass str values to DB API drivers. So it encodes values in .set().

>   File
> "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
> line 387, in _insertSQL
>     ', '.join([self.sqlrepr(v) for v in values])))
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 16:
> ordinal not in range(128)

   AFAIU the same problem as before but in a different place. sqlrepr
tried to re-encode some values and failed as dbEncoding is 'ascii'.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.