#203 0.7.2 bug in creating class fromDatabase

closed-fixed
5
2007-01-10
2006-12-23
Anonymous
No

example:
--- cut ---
from sqlobject import *

sqlhub.processConnection = connectionForURI('firebird://localhost/wwweva')

class selPeople(SQLObject):
class sqlmeta:
fromDatabase = True
pass
--- end cut ---

result:
--- cut ---
Traceback (most recent call last):
File "test_from_Db.py", line 8, in ?
class selPeople(SQLObject):
File "d:\lang\python\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\declarative.py", line 109, in __new__
cls.__classinit__(cls, new_attrs)
File "d:\lang\python\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\main.py", line 782, in __classinit__
cls.sqlmeta.addColumnsFromDatabase()
File "d:\lang\python\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\main.py", line 427, in addColumnsFromDatabase
for columnDef in conn.columnsFromSchema(sqlmeta.table, soClass):
File "D:\Lang\Python\lib\site-packages\sqlobject-0.7.2-py2.4.egg\sqlobject\firebird\firebirdconnection.py", line 193, in columnsFromSchema
colClass, kw = self.guessClass(t.strip(), flength, fscale)
File "D:\Lang\Python\lib\site-packages\sqlobject-0.7.2-py2.4.egg\sqlobject\firebird\firebirdconnection.py", line 215, in guessClass
return col.StringCol, {'length': flength,
NameError: global name 'col' is not defined
--- end cut ---

FIX for this bug:
file: sqlobject\firebird\firebirdconnection.py modify line 129
from: colClass, kw = self.guessClass(t, flength, fscale)
to: colClass, kw = self.guessClass(t.strip(), flength, fscale)

file: sqlobject\firebird\firebirdconnection.py
insert line 2: import sqlobject.col as col

Discussion

  • Oleg Broytman

    Oleg Broytman - 2007-01-10
    • assigned_to: nobody --> phd
    • status: open --> closed-fixed
     
  • Oleg Broytman

    Oleg Broytman - 2007-01-10

    Logged In: YES
    user_id=4799
    Originator: NO

    Fixed in the revision 2197. Thank you!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks