ERRATA^2 The uglyness is back, just encapsulated in local_import (same syntax as proposed). The problem is the orginal implementation does not handle __init__.py properly. Doing so would be too expensive.
Massimo On Oct 30, 11:07 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > ERRATA: > > After more tests > > [....] > > > I found and implemented a better way. With the code in trunk we can > > now do: > > > d = local_import('a.b.c') > > > - it is not based on exec > > actually I when running on GAE the first version did not work. on GAE > it uses execfile. > > > - it searches in applicaitons/currentapp/modules/ before searching in > > sys.path so no conflicts ever > > Do not use it to search sys.path because there are some unresolved > issues > > > - each modules/ folder acts like its own site-packages and you can put > > any third party module in there whether or not is uses relative > > imports > > I was wrong. This still does not work if the imported module does not > use relative imports. > > > - you can ask it force reloading modules at every request, great for > > debugging modules: > > > d = local_import('a.b.c', force=True) > > or "reload" instead of "force" now in trunk. > > Not quote as perfect as I had hoped but it does most of what expected. > > If only there was a way to have a thread level sys.path ... perhaps > there is but I do not know howto. > > Massimo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---