initialize env with abspath
When running scripts, the path used is relative to the web2py root instead of the full path. This causes differences in migrations when using InDBMigrator - this causes pydal to try to repeat migrations already done.
This commit is contained in:
+2
-2
@@ -233,7 +233,7 @@ def run(
|
|||||||
errmsg = 'invalid application name: %s' % appname
|
errmsg = 'invalid application name: %s' % appname
|
||||||
if not a:
|
if not a:
|
||||||
die(errmsg, error_preamble=False)
|
die(errmsg, error_preamble=False)
|
||||||
adir = os.path.join('applications', a)
|
adir = os.path.absdir(os.path.join('applications', a))
|
||||||
|
|
||||||
if not os.path.exists(adir):
|
if not os.path.exists(adir):
|
||||||
if not cron_job and not scheduler_job and \
|
if not cron_job and not scheduler_job and \
|
||||||
@@ -270,7 +270,7 @@ def run(
|
|||||||
if vars:
|
if vars:
|
||||||
# underscore necessary because request.vars is a property
|
# underscore necessary because request.vars is a property
|
||||||
extra_request['_vars'] = vars
|
extra_request['_vars'] = vars
|
||||||
_env = env(a, c=c, f=f, import_models=import_models, extra_request=extra_request)
|
_env = env(a, c=c, f=f, import_models=import_models, extra_request=extra_request, dir=adir)
|
||||||
|
|
||||||
if c:
|
if c:
|
||||||
pyfile = os.path.join('applications', a, 'controllers', c + '.py')
|
pyfile = os.path.join('applications', a, 'controllers', c + '.py')
|
||||||
|
|||||||
Reference in New Issue
Block a user