>
> mod_clients.py = what for?
> mod_users.py = what for?
It was an example, you can have mod_nameyouwant.py.
and inside you have for example something like this:
class Clients(object):
def show():
'show a list of clients'
def delete():
'delete ...'
def add():
'add ...'
2011/5/1 Stifan Kristi <[email protected]>
> thank you so much for your info, martin, i've already tried and learn from
> powerpack plugins, it's cool but because i'm a newbie in python and web2py,
> so that a lot of things on powerpack that i don't know the function is what
> for?
> pardon me, could you explain about:
> mod_clients.py = what for?
> mod_users.py = what for?
>
> many thanks before
>
> On Sun, May 1, 2011 at 7:58 PM, Martín Mulone <[email protected]>wrote:
>
>> 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 <[email protected]>
>>
>>> 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 <[email protected]>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 <[email protected]> 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
>>
>>
>
--
http://martin.tecnodoc.com.ar