It all starts in gluon.main.wsgibase, which eventually calls gluon.main.serve_controller here<https://github.com/web2py/web2py/blob/master/gluon/main.py#L446>. >From there, much of the action jumps to gluon.compileapp. serve_controller first calls gluon.compileapp.build_environment here<https://github.com/web2py/web2py/blob/master/gluon/main.py#L177>, which builds the global environment containing the web2py API. build_environment starts with _base_environment_ (defined here<https://github.com/web2py/web2py/blob/master/gluon/compileapp.py#L381>), which includes the HTML helpers, validators, DAL, Field, etc.
serve_controller then calls gluon.compileapp.run_models_in here<https://github.com/web2py/web2py/blob/master/gluon/main.py#L190>. run_models_in then executes the code for each model file (depending on response.models_to_run) in the global environment. After running the models, serve_controller eventually calls functions to run the controller, and if necessary, the view. Note, serve_controller ultimately ends by raising an HTTP exception, which is why the code in wsgibase is structured in a try/except -- it catches the HTTP exception and does some further processing before returning the response. Anthony On Thursday, January 30, 2014 10:21:03 AM UTC-5, Cliff Kachinske wrote: > > I'm giving a talk on DAL at the Pyatl meetup next Thursday. It's going to > include some code reading, mostly from gluon. > > There are a few things I can't figure out, though. > > 1. I can't find the code that loads model files. > > 2. I'm not sure how DAL gets into the name space for the model files. I > see where gluon.__init__ imports it, but I don't think that's the answer. > > Any pointers greatly appreciated. > > Thanks, > Cliff Kachinske > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

