[SQLObject] bug with python24 and fromDatabase=True
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: sophana <so...@zi...> - 2006-04-04 23:27:15
|
Hi I'm running centos 4 which has python2.3. I installed python24 from atrpms to run kid templates. I have create an SQLObject with sqlmeta.fromDatabase=True. with python23, everything work fine with python24, I have an error when sqlobject list the columns. instead of getting strings, it gets an array object: seems like dbConnection.fetchAll returns weird values. >>> pdb.pm() > /usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/mysql/mysqlconnection.py(140)guessClass() -> if t.startswith('int'): (Pdb) print t array('c', 'int(11) unsigned') (Pdb) print t.__class__ <type 'array.array'> (Pdb) l 135 # @@ skip extra... 136 results.append(colClass(**kw)) 137 return results 138 139 def guessClass(self, t): 140 -> if t.startswith('int'): 141 return col.IntCol, {} 142 elif t.startswith('varchar'): 143 if t.endswith('binary'): 144 return col.StringCol, {'length': int(t[8:-8]), 145 'char_binary': True} (Pdb) u > /usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/mysql/mysqlconnection.py(130)columnsFromSchema() -> colClass, kw = self.guessClass(t) (Pdb) l 125 % tableName) 126 results = [] 127 for field, t, nullAllowed, key, default, extra in colData: 128 if field == 'id': 129 continue 130 -> colClass, kw = self.guessClass(t) 131 kw['name'] = soClass.sqlmeta.style.dbColumnToPythonAttr(field) 132 kw['notNone'] = not nullAllowed 133 kw['default'] = default 134 # @@ skip key... 135 # @@ skip extra... (Pdb) print colData ((array('c', 'id'), array('c', 'int(11) unsigned'), array('c'), array('c', 'PRI'), None, array('c', 'auto_increment')), (array('c', 'UserName'), array('c', 'varchar(64)'), array('c'), array('c', 'MUL'), array('c'), array('c')), (array('c', 'Attribute'), array('c', 'varchar(32)'), array('c'), array('c'), array('c'), array('c')), (array('c', 'op'), array('c', 'char(2)'), array('c'), array('c'), array('c', '=='), array('c')), (array('c', 'Value'), array('c', 'varchar(253)'), array('c'), array('c'), array('c'), array('c'))) (Pdb) |