My point of views is that in a simple and smaller app this approach is a
good (may be the only) option.
I am now running with a different numerical order, using 3 digits
000_essentials.py
100_authdatabase.py
200_dbmodel.py
300_validators.py
400_utilities.py
500_preload.py
why? because between every model I have 99 empty spaces if I need to include
some new model without the need to rename all the others.
But this is a mess if working with a large app, so I tried to create classes
and methods as:
class mymodel(object):
def define_essentials():
db = DAL('.....')
def define_auth():
auth = Auth(db...)
def define_model():
db.define_table('mytable',Field(....))
So I can call mymodel.define_essentials() directly from the controller or
another main model, why?
Imagine a large app with many models and many objects loaded in memory even
if you do not need them.
But, I think web2py has a good MVC pattern used for controllers and views,
we are talking about how to have the same approach for model files.
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
On Sun, May 1, 2011 at 12:37 AM, pbreit <[email protected]> wrote:
> I think either way is fine. In a bigger app, you might separate them out.
>
> Vinicius, I like that approach.
>