I'm not sure what you're getting at here, but if you consider Python is 
a very dynamic language.  Whenever a module is imported, it is 
essentially run in it's own namespace.  In the case of your plugin 
(driver) system (which I haven't looked at yet), you could have an 
SQLDBFactory function that runs at import-time, loading the available 
db-engine plugins, and producing a functional SQLDB class.

Reimporting a module does not re-run the module unless you call 
reload(modname).  If you have code that you want to run once, put it in 
a module that is normally imported (such as sql.db)

This is the area where Javascript has made me a better Python 
programmer.  =)

-tim

billf wrote:
> Basically, is there any code that receives control when an application
> first starts that allows some initialisation/configuration that
> doesn't have to run after every request?
>
> I believe code could be put in db.py but that is not ideal
> conceptually - and would run on every request?
>
> I can see that there are pros and cons to the idea of "on start" code
> and would be interested in peoples' views.
> >
>   

-- 
Timothy Farrell <tfarr...@swgen.com>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to