You have to crate a function that given the request.vars.client_name 
creates the db object and calls the define_table's
In your model you have request.vars.client_name and you can call that 
function.
In your tasks you would call that function from your task with a parameter 
specfied when you enqueued the task.

On Monday, 4 June 2018 20:55:42 UTC+2, Bryan Chance wrote:
>
> So I'm working to consolidate severall web2py apps that share ~85% of 
> their code. They each have their own configurations, databases, etc.
>
> I accomplish this by using routes.py to map myurl.com/client_name to 
> myurl.com/consolidated_app?client_name=client_name
>
> Then request.vars.client_name allows me to load client-specific db uris, 
> models_to_run, etc. Now I need a way to do a similar thing with the 
> scheduler. Since the request doesn't go the way http requests do, I can't 
> load the "environment" to look the way for task for CllientA the way it 
> would look for browsing myurl.com/ClientA.
>
> The only other way I can think to solve this would be to pass all needed 
> data to queue_task and then create new db connections there. But then I run 
> into the issue of the models won't be loaded as expected.
>
> Does anyone have any ideas?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to