There was some change around 1081 (as reported by Matthew Bevan in this post) that now causes a class (in an external module configured using TG's startup/shutdown notification entry point) inheriting from an InheritableSQLObject to throw the following traceback:
Traceback (most recent call last):
File "/usr/bin/tg-admin", line 7, in ?
sys.exit(
File "/usr/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 236, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 2097, in load_entry_point
return ep.load()
File "/usr/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 1830, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/home/mbevan/Projects/turbogears/turbogears/__init__.py", line 18, in ?
ext = entrypoint.load()
File "/usr/lib/python2.4/site-packages/setuptools-0.6a11-py2.4.egg/pkg_resources.py", line 1830, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/home/mbevan/Projects/TG-Content/content/__init__.py", line 23, in ?
from content import controllers, model, widgets
File "/home/mbevan/Projects/TG-Content/content/model.py", line 16, in ?
class Bob(Test):
File "/home/mbevan/Projects/turbogears/thirdparty/sqlobject/sqlobject/declarative.py", line 108, in __new__
cls.__classinit__(cls, new_attrs)
File "/home/mbevan/Projects/turbogears/thirdparty/sqlobject/sqlobject/main.py", line 748, in __classinit__
if not connection and not getattr(cls, '_connection', None):
File "/home/mbevan/Projects/turbogears/turbogears/database.py", line 148, in __get__
self.set_hub()
File "/home/mbevan/Projects/turbogears/turbogears/database.py", line 166, in set_hub
raise KeyError, "No database configuration found!"
KeyError: 'No database configuration found!'
The above is thrown during TG initialization - applications no longer start up, and the tg-admin tool can no longer run.
I have been able to reproduce this error with a very simple (~60 lines of code including setup.py) set-up, and this error would even work as a system-wide DOS attack against the current version of TG. This is a show-stopping problem for the project Matthew and I are working on.
The simple case is attached. To reproduce:
- Extract the contents of the attached file (SimpleTest-1.0.0.tar.bz2) into a temporary directory.
- Enter the SimpleTest directory.
- Run sudo ./setup.py develop to install.
- Attempt to run tg-admin or any TurboGears application.