Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2160 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

[PATCH] Problems when importing SO model.py with no dburi set up

Reported by: chrisz Owned by: faide
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0.8
Severity: normal Keywords:
Cc:

Description

You cannot import a model.py file for SQLObject that includes inheritance (such as the one below) from outside TurboGears or when no dburi is set up, as reported on the TG group  here; you will get a 'No database configuration found!' error:

from sqlobject import SQLObject, StringCol
from turbogears.database import PackageHub 

__connection__ = PackageHub('test') 

class data(SQLObject):
    item = StringCol()

class deleted_data(data):
    time = DateTimeCol()

I have attached a simple fix that solves the problem (for an explanation, see the discussion thread above). It should be applied to all TG 1.x versions.

Attachments

somodel.patch Download (682 bytes) - added by chrisz 9 years ago.
Patch as described on the turbogears group
somodel2.patch Download (984 bytes) - added by chrisz 9 years ago.
Improved patch that also fixes #763

Change History

Changed 9 years ago by chrisz

Patch as described on the turbogears group

Changed 9 years ago by chrisz

Improved patch that also fixes #763

comment:1 Changed 9 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to fixed

Applied in r6206.

Note: See TracTickets for help on using tickets.