Hi,

1. In the web2py book, there is an example for Auth settings, which 
presumably resides at top-level inside a model:

auth.settings.register_onaccept.append(lambda form: mail.send(to=
'y...@example.com', subject='new user', message="new user email is %s' % 
form.vars.email))

and I wonder where exactly do these 'form' and 'form.vars.email' variables 
come from and how do we know which specific variables are available for 
which functions in web2py, such information seems to be poorly documented 
in the manual.

2. Is it advisable to organize models into different folders named by their 
related controllers? For example, for all account-related functionalities, 
I create a model called 'account.py' and put it at 
'my_app/models/account/account.py', so that only this model will be 
executed for all account-related requests. Similarly, a model named 
'content.py' is created in 'my_app/models/content/content.py', so that only 
this model will be executed for all the requests relating to user-generated 
content. By doing this (as opposed to put all the models in 
'my_app/models/'), we can avoid executing models we don't need for certain 
requests, but we may need to duplicate some code (e.g. create db 
connections) for different models. Is this a good practice in web2py?

-- 



Reply via email to