Hi,

I've been using SQLObject for a while, but now I needed to use some
Unicode in it, but it fails to include the data in the database. The
model:

class Report(SQLObject):
  title = UnicodeCol(dbEncoding="UTF-8") # I know, UTF-8 is default,
but just to be sure.
  model = ForeignKey('Model')
  field = ForeignKey('Field')
  interval = ForeignKey('Field')
  from_value = IntCol()
  to_value = IntCol()

then the example:

Report(title="Totó", model=m, field=f, interval=i, from_value=22, to_value=2342)

results in:
In [7]: Report(title="Tot", model=m, field=f, interval=i,
from_value=22, to_value=2342)
---------------------------------------------------------------------------
exceptions.UnicodeDecodeError                        Traceback (most
recent call last)

/home/bernardo/codes/frota/<ipython console>

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/declarative.py
in _wrapper(self, *args, **kwargs)
     90         def _wrapper(self, *args, **kwargs):
     91             lock.acquire()
---> 92             return_value = fn(self, *args, **kwargs)
     93             lock.release()
     94             return return_value

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/main.py
in __init__(self, **kw)
   1195             id = None
   1196
-> 1197         self._create(id, **kw)
   1198
   1199     def _create(self, id, **kw):

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/main.py
in _create(self, id, **kw)
   1222
   1223         # Then we finalize the process:
-> 1224         self._SO_finishCreate(id)
   1225
   1226     def _SO_finishCreate(self, id=None):

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/main.py
in _SO_finishCreate(self, id)
   1246         # non-standard.
   1247         id = self._connection.queryInsertID(self,
-> 1248                                             id, names, values)
   1249         cache = self._connection.cache
   1250         cache.created(id, self.__class__, self)

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/dbconnection.py
in queryInsertID(self, soInstance, id, names, values)
    757     def queryInsertID(self, soInstance, id, names, values):
    758         self.assertActive()
--> 759         return self._dbConnection._queryInsertID(
    760             self._connection, soInstance, id, names, values)
    761

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/mysql/mysqlconnection.py
in _queryInsertID(self, conn, soInstance, id, names, values)
     76         if self.debug:
     77             self.printDebug(conn, q, 'QueryIns')
---> 78         self._executeRetry(conn, c, q)
     79         if id is None:
     80             try:

/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1747-py2.4.egg/sqlobject/mysql/mysqlconnection.py
in _executeRetry(self, conn, cursor, query)
     58         while 1:
     59             try:
---> 60                 return cursor.execute(query)
     61             except MySQLdb.OperationalError, e:
     62                 if e.args[0] == 2013: # SERVER_LOST error

/home/bernardo/codes/frota/build/bdist.linux-i686/egg/MySQLdb/cursors.py
in execute(self, query, args)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
94: ordinal not in range(128)

In [8]:


And yes, the terminal is configured to UTF-8.
Any Ideas?
Thanks,
Bernardo


_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to