Hi!
I started to use the debian version of web2py, which comes with an
executable '/usr/bin/web2py'. It was run from a custom directory under
'/home/web2py'. This script gets the current directory, and adds it to
the command line with a '-f' switch, and chdir-s into '/usr/share/
web2py'. This worked fine at first.
But then I added a custom module under 'applications/myapp/modules'.
Had '__init__.py'-s everywhere. But the module couldn't be imported
from a controller using the 'import mymodule' syntax. The 'mymodule =
local_import("mymodule")' works, though. So I started some
investigation.
It seems that the import mechanism is implemented in the
'custom_import.py' by calling 'custom_import_install(web2py_path)'.
But its argument is always '/usr/share/web2py', so when later checking
the importing file's name in '_matchAppDir', it concludes that it is
not under that directory, and skips the importing magic. The
application is not there, it is under '/home/web2py', as specified
with the '-f' switch. The 'custom_import_install' is called in
'main.py' during module load, while the command line is only checked
in the HttpServer constructor. So the custom import mechanism ignores
the command line switch, and all files under the specified directory.
Am I correct on this one?