In powerpack I have this: config.py (application settings) data.py (all the db definition and menus) main.py (auth, mail, service, registration settings, etc) (this is independant of the app)
then I usually do: mod_clients.py mod_users.py mod_someother.py mod_someother2.py I have classes like bruno show, but I don't have db definitions in this classes, instead I have all the db definition in data.py because surely I have link to another tables. Then came the plugins: plugins_xxxx1.py plugins_xxxx2.py plugins_xxxx3.py plugins_xxxx4.py plugins_zindex.py (here the execution order of plugins) 2011/5/1 Stifan Kristi <steve.van.chris...@gmail.com> > i'd like your logic bruno, could you explain about the function, please? > 000_essentials.py = what for? > 100_authdatabase.py = what for? > 200_dbmodel.py = what for? > 300_validators.py = what for? > 400_utilities.py = what for? > 500_preload.py = what for? > > thank you so much > > On Sun, May 1, 2011 at 11:03 AM, Bruno Rocha <rochacbr...@gmail.com>wrote: > >> 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 <pbreitenb...@gmail.com> wrote: >> >>> I think either way is fine. In a bigger app, you might separate them out. >>> >>> Vinicius, I like that approach. >>> >> >> > -- http://martin.tecnodoc.com.ar