Also, note that models_to_run is a list of regexes (relative to the /models 
folder), so you don't need to list each individual model file.

Anthony

On Saturday, January 18, 2014 2:08:16 PM UTC-5, Anthony wrote:
>
> Only the default value of models_to_run assumes a 1:1 correspondence 
> between controllers and models. You can set the value of models_to_run to 
> whatever you want conditionally (and it can even change multiple times from 
> model file to model file). So, for example, you could do:
>
> if request.controller in ['controller1', 'controller2', 'controller3']:
>     response.models_to_run = ['path/to/modelA.py', 'path/to/modelB.py']
>
> In any case, you still might prefer to put model definitions in modules 
> and import where needed.
>
> Anthony
>
> On Saturday, January 18, 2014 8:11:29 AM UTC-5, Arnon Marcus wrote:
>>
>> Thanks anthony, you're right - this models_to_run approach makes no sense 
>> in my use-case - it assumes a 1:1 correlation between controllers and their 
>> used-models, which would only occure in very simple apps. The whole point 
>> of using a relational database is to have great flexibility and diversity 
>> of relations. The models_to_run approach seems to assume a very restricted 
>> use-pattern of relations.
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to