Hi All,

While autoloading tables using turbogears.database.metadata, I get the
following error:
--------------------
[EMAIL PROTECTED] tm]# ./start-tm.py
Traceback (most recent call last):
  File "./start-tm.py", line 26, in ?
    from tm.controllers import Root
  File "/Data/PIPLData/Projects/TM/trunk/tm/tm/controllers.py", line
13, in ?
    user_tbl = Table('tg_user', metadata, autoload=True)
  File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.2.6-py2.4.egg/sqlalchemy/schema.py",
line 97, in __call__
    metadata.engine.reflecttable(table)
AttributeError: 'NoneType' object has no attribute 'reflecttable'
--------------------
The code is given below:

# controllers.py
# imports
.
.
from sqlalchemy import *
from turbogears.database import metadata, session
.
.
# end imports

user_tbl = Table('tg_user', metadata, autoload=True)
-------------------------
However, if I move the line to the index method, as given below, I
don't get the error while running the index method, i.e. while viewing
the home page.
.
.
   @expose(template=".templates.intro")
    def index(self):
        user_tbl = Table('tg_user', metadata, autoload=True)
        return dict()
.
.
------------------------
With my beginner's level of knowledge, what I guess is, metadata is
getting initialized at a later point than is being used.

Need guidence on how to handle this. Thanks a lot.

Sanjay


--~--~---------~--~----~------------~-------~--~----~
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