I have a model.py file that I want to share between a web-based and
non-web-based application (essentially I have a long-running background
task that creates database objects, and then a web server that queries
these objects.)

My first attempt was to simply include the "model.py" file into my
non-web application - however, whenever I attempted to access an
object, I would get an error telling me that there was no database
connection (even though I had initialized sqlhub and set up the
connection already.)

If I comment out the lines:

   from turbogears import identity
   from turbogears.database import PackageHub
   hub = PackageHub("monsterbuilder")
   __connection__ = hub

the non-web app works fine, but the web-based application no longer
works.

So my second attempt was to split out the database classes into a
separate source file. So I have "model.py" which contains the
boilerplate identity classes, and "model_jobs.py" which contains my
application specific-classes. I import the classes from "model_jobs"
into "model" so that all of the classes will be visible to the web app.

This doesn't work either - the non-web app works fine, but the various
TG-based tools - "tg-admin sql create", Catwalk, etc - can't see the
classes in "model_jobs". If I use "sql create -m model_jobs", it will
create the tables, but Catwalk still can't see them, and the web app
complains that there's no database connection whenever I try to use
them.

Any suggestions as to what to try next?

-- Talin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to