Merge branch 'master' of github.com:web2py/web2py

This commit is contained in:
mdipierro
2019-08-17 22:46:56 -07:00
7 changed files with 18 additions and 7 deletions
+6
View File
@@ -266,6 +266,12 @@ web2py will attempt to run a GUI to ask for it when starting the web server
'(default is %(default)s), see -S above. NOTE: when the APP_ENV ' '(default is %(default)s), see -S above. NOTE: when the APP_ENV '
'argument of -S include a controller c automatic import of ' 'argument of -S include a controller c automatic import of '
'models is always enabled') 'models is always enabled')
g.add_argument('--fake_migrate',
default=False,
action='store_true',
help=
'force DAL to fake migrate all tables; '
'monkeypatch in the DAL class to force _fake_migrate=True')
g.add_argument('--force_migrate', '--force-migrate', g.add_argument('--force_migrate', '--force-migrate',
default=False, default=False,
action='store_true', help= action='store_true', help=
+1
View File
@@ -237,6 +237,7 @@ WRAPPER = """
\\usepackage{graphicx} \\usepackage{graphicx}
\\usepackage{grffile} \\usepackage{grffile}
\\usepackage[utf8x]{inputenc} \\usepackage[utf8x]{inputenc}
\\usepackage{textgreek}
\\definecolor{lg}{rgb}{0.9,0.9,0.9} \\definecolor{lg}{rgb}{0.9,0.9,0.9}
\\definecolor{dg}{rgb}{0.3,0.3,0.3} \\definecolor{dg}{rgb}{0.3,0.3,0.3}
\\def\\ft{\\small\\tt} \\def\\ft{\\small\\tt}
+1 -1
View File
@@ -80,7 +80,7 @@ def latex2pdf(latex, pdflatex='pdflatex', passes=3):
outfile.close() outfile.close()
re_errors = re.compile('^\!(.*)$', re.M) re_errors = re.compile('^\!(.*)$', re.M)
re_warnings = re.compile('^LaTeX Warning\:(.*)$', re.M) re_warnings = re.compile('^LaTeX Warning\:(.*)$', re.M)
flog = open(logname) flog = open(logname,encoding="utf-8")
try: try:
loglines = flog.read() loglines = flog.read()
finally: finally:
+4 -1
View File
@@ -217,7 +217,8 @@ def run(
python_code=None, python_code=None,
cron_job=False, cron_job=False,
scheduler_job=False, scheduler_job=False,
force_migrate=False): force_migrate=False,
fake_migrate=False):
""" """
Start interactive shell or run Python script (startfile) in web2py Start interactive shell or run Python script (startfile) in web2py
controller environment. appname is formatted like: controller environment. appname is formatted like:
@@ -248,6 +249,7 @@ def run(
fileutils.create_app(adir) fileutils.create_app(adir)
if force_migrate: if force_migrate:
c = 'appadmin' # Load all models (hack already used for appadmin controller)
import_models = True import_models = True
from gluon.dal import DAL from gluon.dal import DAL
orig_init = DAL.__init__ orig_init = DAL.__init__
@@ -255,6 +257,7 @@ def run(
def custom_init(*args, **kwargs): def custom_init(*args, **kwargs):
kwargs['migrate_enabled'] = True kwargs['migrate_enabled'] = True
kwargs['migrate'] = True kwargs['migrate'] = True
kwargs['fake_migrate'] = fake_migrate
logger.info('Forcing migrate_enabled=True') logger.info('Forcing migrate_enabled=True')
orig_init(*args, **kwargs) orig_init(*args, **kwargs)
+1 -3
View File
@@ -2638,9 +2638,7 @@ class Auth(AuthAPI):
# invalid login # invalid login
session.flash = specific_error if self.settings.login_specify_error else self.messages.invalid_login session.flash = specific_error if self.settings.login_specify_error else self.messages.invalid_login
callback(onfail, None) callback(onfail, None)
if 'password' in request.post_vars: redirect(self.url(args=request.args, vars=request.get_vars),client_side=settings.client_side)
del request.post_vars['password']
redirect(self.url(args=request.args, vars=request.vars),client_side=settings.client_side)
else: # use a central authentication server else: # use a central authentication server
cas = settings.login_form cas = settings.login_form
+2 -1
View File
@@ -741,7 +741,8 @@ def start():
sys.argv = [options.run or ''] + options.args sys.argv = [options.run or ''] + options.args
run(options.shell, plain=options.plain, bpython=options.bpython, run(options.shell, plain=options.plain, bpython=options.bpython,
import_models=options.import_models, startfile=options.run, import_models=options.import_models, startfile=options.run,
cron_job=options.cron_job, force_migrate=options.force_migrate) cron_job=options.cron_job, force_migrate=options.force_migrate,
fake_migrate=options.fake_migrate)
return return
# set size of cron thread pools # set size of cron thread pools
+3 -1
View File
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' '''
To use, e.g. python .\web2py.py -S APPNAME --force_migrate To use, e.g. python .\web2py.py -S APPNAME --force_migrate
To use, e.g. python .\web2py.py -S APPNAME --force_migrate --fake_migrate
''' '''
import logging import logging
@@ -31,5 +32,6 @@ for db_name in databases:
for table_name in tables: for table_name in tables:
# Force migration of lazy tables # Force migration of lazy tables
logger.debug("Ensuring migration of table '%s'", table_name) logger.debug("Ensuring migration of table '%s'", table_name)
db(db[table_name]).isempty() table = db[table_name]
db(table).isempty()
db.commit() db.commit()