So one of my model files is somewhat unique (and possibly a bad idea) and
causing me problems...I'll try to describe things the best I can.
My application creates tables dynamically based on user input. To stop
web2py from defining all the tables on every request (which can be a lot in
the whole app, but only 10ish per user), I check which tables the user has
access to and define only those. This is done by looking at a table
(projects) where each record specifies other tables that exist (the project
support tables).
The issue i'm having is the user fills out a form using smartgrid. In the
oncreate callback I update the projects table which essentially specifies
new tables. These new tables are not defined unless the model runs again.
I know this will happen on a refresh, but is there any other way to force
the models to update?
If I then submit a job to the scheduler that references one of these "new"
tables I get this error:
'DAL' object has no attribute 'test_project_proj'
Where test_project_proj one of the support tables that should have been defined
(in the model snippet below project.project_table = 'test_project_proj') .
Example of key part of the model:
user_allowed_ids = get_user_allowed_projects(False) for project in db(db.
projects.id.belongs(user_allowed_ids)).select():
db.define_table(project.project_table,......)
db.define_table(project.block_table,......)
db.define_table(project.metadata_table,......)
I thought that when a job runs on the scheduler it re-runs all the models, so i
don't understand why the task isn't seeing the new tables. Thoughts? Thanks
Dean
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.