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 <[email protected]>
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to