On Oct 18, 2010, at 8:10 AM, mdipierro wrote: > > It is not web2py doing. web2py files (models, views, controllers) and > not cached unless explicitly stated. > > Python caches modules. > > after > > import module > > you can do > > reaload(module) > > to force reload.
A variation on the theme. I have this in some of my code: if APP_PRODUCTION: dt = local_import('datatables', reload=False) else: # pragma: no cover dt = local_import('datatables', reload=True) APP_PRODUCTION is defined True or False at the head of my db.py. I use it for this and to choose a log level, etc. > > > > On Oct 18, 10:00 am, apple <simo...@gmail.com> wrote: >> This driving me crazy. Is there some kind of code cache in web2py and >> how do I turn it off? >> >> From a controller I call a python program in modules and web2py >> correctly reports an error: >> html=cleaner.clean_html(html) >> NameError: global name 'cleaner' is not defined >> >> I then comment out the offending line and rerun. However it appears >> that the old version of the code is still running. Web2py still >> reports an error but this time highlights the new source code where >> the bad line has been commented out! >> #html=cleaner.clean_html(html) >> NameError: global name 'cleaner' is not defined >> >> If I stop and start the web2py server same problem. If I close down >> web2py entirely and restart then it behaves as it should. This is >> quite annoying as every time I make a change to the code I have to >> shut down web2py and restart to make sure I have the correct version.