Massimo my suggest was conditionals, Bruno the way I handle mine there is
no repeating of model definitions.

db_tables.py
# define all tables in a function this file should be out side of the
models directory
def define_tables(db, tables=[], migrate=False, fake_migrate=True)

models/global.py <- Use define_tables() to define all tables required by
all controllers
models/controler/global.py <- Use define_tables() to add more tables used
only by this controller but all actions in this controller
models/controler/action/db.py <- Use define_tables() for tables that have
not been defined yet but are required for this action.

This situation works pretty good without having all the import's inside
controllers :D

On Tue, Jul 17, 2012 at 11:29 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> There is an old proposal from Mariano to address that we should revisit
> that. Yet I find that if a model is needed by multiple controllers, it can
> be defined at top-level. It is in general a good design to group actions in
> controllers depending on which models they need.
>
>
> On Tuesday, 17 July 2012 12:51:36 UTC-5, rochacbruno wrote:
>>
>> The conditional models are good, but the problem is the fact that they
>> are not reusable, when you need the same table on multiple controllers, or
>> you have to define it globally, or you have to repeat the definition on
>> every sub model.
>>
>> I think having a module with functions or classes to define the tables
>> are better, and qhen you have this, you dont need to use submodels, because
>> you can run each desired function/class direclty on the controller.
>>
>> On Tue, Jul 17, 2012 at 2:46 PM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> I remind the readers we have conditional models:
>>>
>>> models/db.py (runs for every action)
>>> models/default/db.py runs (runs only for actions in
>>> controllers/default.py)
>>> models/default/index/db.py runs (runs only for action index() in
>>> controllers/default.py)
>>>
>>> This speeds things a lot.
>>>
>>
>>  --
>
>
>
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com

-- 



Reply via email to