You would probably be better off explicitly setting response.models_to_run 
<http://web2py.com/books/default/chapter/29/04/the-core#markmin_response_models_to_run>.
 
For example, in the first model file:

response.models_to_run = []
if request.controller in ['controller1', 'controller3']:
    response.models_to_run.append('model1.py')
etc.

Of course, you could write something more sophisticated to more easily map 
a set of model files to a set of controllers.

Anthony

On Monday, January 4, 2016 at 3:23:11 PM UTC-5, Marcelo Theodoro wrote:
>
> I'm working on a project that has a lot of table definitions. For reasons 
> of better performance and design, I've decided to use Condicional models.
>
>
> The problem is: Each one of the controllers, needs more than one model, 
> and each model is used by more than one of the controllers. Something like:
>
>
> - Controllers:
>  -- controller1.py
>  -- controller2.py
>  -- controller3.py
>
>
> - Models
>  -- model1.py
>  -- model2.py
>  -- model3.py
>
>
> * controller1.py needs model1.py and model2.py
> * controller2.py needs model2.py, and model3.py
> * controller3.py needs model1.py and model3.py
>
>
> The "workaround" I'm using at the moment is to place every model in 
> app_name/models/models, and then creating symbolic links to each controller 
> folder inside /models/:
>
> > ln -s models/models/model1.py models/models/model2.py models/controller1/
> > ln -s models/models/model2.py models/models/model3.py models/controller2/
> > ln -s models/models/model1.py models/models/model3.py models/controller3/
>
> I'm creating symbolic links instead of copy the models because I don't 
> want to edit a lot of files when I need to edit one model.
>
>
> It's working well. But I'm not sure if it's the best way of doing that. 
> Also, there's two problem with that:
> a) appadmin doesn't work anymore. When I open the appadmin happens an 
> error: "table already defined". I understand why this is happening, but I 
> can't think how to solve it.
> b) When I clone de source code of the app from the Github in a Linux PC, 
> the symlinks are created. But if the machine is running WIndows, the 
> symlinks are not automatically created. 
>
>
> Any suggestions would be appreciated.
>

-- 
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/d/optout.

Reply via email to