Thanks for quick action! I also confirm latest trunk has reload feature now. So we have a happy ending, for the Independent Day. :-)
On Jul4, 3:36pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > You are right. I fixed it in trunk and it works for me now. > > Massimo > > On 4 Lug, 01:22, Iceberg <iceb...@21cn.com> wrote: > > > Are you so sure __import__() always reloads? I don't believe so, and > > that is also why there is a built-in reload(). At least __import__() > > does not reload in my following simple test. Jose, would you please > > also try this one? > > > # myapp/modules/foo.py > > def bar(): > > return 'hello world' > > > # myapp/controllers/test.py > > def index(): > > return local_import('foo', reload=True) > > > Visithttp://localhost:8000/myapp/testandyou will see "hello world". > > Fine. Don't restart web2py, now change bar() as return 'something > > else', refresh your browser. So far I still see "hello world" but not > > "something else". Besides, the myapp/modules/foo.pyc is NOT rebuilt > > according to its file create timestamp, thus another evidence that the > > reload did not happen. I am using latest trunk on Windows XP, Python > > 2.5.4 > > > By the way, an equivalent, cleaner and faster refactoring is > > legitimate, as long as it works. I will agree on a __import__() feels > > better than an exec(...), so let's first get things right.