This is the very first time I have ever messed with python code and
only then with help from #python. I know there are probably a zillion
righteous ways to do it but this actually works, for me. Aim; to
provide a dynamic default database value to TurboGears so that no
config file(s) have to be edited to get a simple example working. Using
this method, or something similar, means that a *simple* tutorial can
be distributed and unzipped and immediately used without being forced
to edit dev.cfg.
. in dev.cfg comment out all sqlobject.dburi values
. mv your_sqlite.db to "default.sqlite"
. add to *-start.py -> "from os.path import *"
. add to *-start.py -> "tg_path = dirname(realpath(__file__))"
. add to /your_tg_install_path/turbogears/database.py line line ~10
-> import __main__ as main
. change /your_tg_install_path/turbogears/database.py line line ~142
from -> dburi = cherrypy.config.get("sqlobject.dburi", None)
to -> dburi = cherrypy.config.get("sqlobject.dburi",
"sqlite://%s/default.sqlite" % main.tg_path)
. start your *-start.py server
Bingo! Hopefully somebody who knows how to will add something like this
properly.
--mark(what's a global between friends)c