From: Max I. <ma...@uc...> - 2004-12-29 08:21:32
|
Hi, I believe I found a bug with either new UnicodeCol or the selectBy method, but I'm not sure hence post it here instead of SF bug tracker. I have a table which has a column declared like this: class User(SQLObject): ... email = UnicodeCol(length=96, default=None, unique=True) getting and setting the value with unicode string works fine. I.e. both user.email = u'something' and print user.email # -> u'something' works fine. The problem is with the following code: dbusers = User.selectBy(isGuest=False, email=email) n = dbusers.count() It yields an error: File "D:\Python23\Lib\site-packages\sqlobject\main.py", line 1322, in count count = self.accumulate('COUNT(*)') File "D:\Python23\Lib\site-packages\sqlobject\main.py", line 1316, in accumulate return conn.accumulateSelect(self,expression) File "D:\Python23\Lib\site-packages\sqlobject\dbconnection.py", line 256, in accumulateSelect val = int(self.queryOne(q)[0]) File "D:\Python23\Lib\site-packages\sqlobject\dbconnection.py", line 230, in queryOne return self._runWithConnection(self._queryOne, s) File "D:\Python23\Lib\site-packages\sqlobject\dbconnection.py", line 125, in _runWithConnection val = meth(conn, *args) File "D:\Python23\Lib\site-packages\sqlobject\dbconnection.py", line 223, in _queryOne self._executeRetry(conn, c, s) File "D:\Python23\Lib\site-packages\sqlobject\dbconnection.py", line 196, in _executeRetry return cursor.execute(query) TypeError: argument 1 must be str, not unicode Guess this is because email has not been coerced from unicode string to db encoding as being done by normal getters and setters. |