Gah, I completely forgot about the db[name] syntax. That is much better. Also I'm an idiot because I just noticed that I had at some point commented out the line in the model that generates the tables >_<. That's what I get for coding late at night. Thanks for pointing out the syntax though.
On Aug 15, 1:01 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > Please do not do this > SQLTABLE(getattr(db, 'user')) # NOT OK > instead do this > SQLTABLE(db.user) #OK > or > SQLTABLE(db['user']) #OK > > I do not understand what you mean by "tables that have been generated > from an xml file". > > Massimo > > On Aug 15, 12:17 am, Alastair Medford <alastairmedf...@gmail.com> > wrote: > > > I am having a problem using SQLFORM with tables that have been > > generated from an xml file. The error I'm getting is a key error, from > > trying to SQLFORM(getattr(db, tablename)). I'm pretty sure this is > > because the tables being generated in the model have not been > > 'finalized' so to speak when the code in the controller function is > > being compiled. Doing SQLTABLE(getattr(db, 'user')), works fine, since > > the users table is being defined normally, and not generated like the > > others. Also, when I check the db admin, the generated tables do exist > > and can be operated on just like a normal one. > > > Is there any way to work around this? I don't really understand why > > getattr is throwing a key error in the first place, since I would have > > thought the model would be set in stone before the code in the > > controller is being run. The db admin doesn't seem to have any > > problems using them. Any help on the subject is appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---