Only prompt for upgrades if there's a TTY & mark 1.1.0 (#537)

This commit is contained in:
Kevin Chung
2017-12-22 13:10:40 -05:00
committed by GitHub
parent f11b5985d3
commit 7e5e18fd6e
2 changed files with 12 additions and 8 deletions

View File

@@ -41,6 +41,7 @@
* SMTP email connections take priority over mailgun settings now. The opposite used to be true.
* The JavaScript `submitkey()` function now takes an optional callback.
* `utils.get_config()` no longer looks at `app.config` values. Instead use `utils.get_app_config()`.
* Only prompt about upgrades when running with a TTY.
1.0.5 / 2017-10-25

View File

@@ -17,7 +17,7 @@ if sys.version_info[0] < 3:
reload(sys)
sys.setdefaultencoding("utf-8")
__version__ = '1.1.0a1'
__version__ = '1.1.0'
class CTFdFlask(Flask):
@@ -64,14 +64,17 @@ class ThemeLoader(FileSystemLoader):
def confirm_upgrade():
print("/*\\ CTFd has updated and must update the database! /*\\")
print("/*\\ Please backup your database before proceeding! /*\\")
print("/*\\ CTFd maintainers are not responsible for any data loss! /*\\")
if input('Run database migrations (Y/N)').lower().strip() == 'y':
return True
if sys.stdin.isatty():
print("/*\\ CTFd has updated and must update the database! /*\\")
print("/*\\ Please backup your database before proceeding! /*\\")
print("/*\\ CTFd maintainers are not responsible for any data loss! /*\\")
if input('Run database migrations (Y/N)').lower().strip() == 'y':
return True
else:
print('/*\\ Ignored database migrations... /*\\')
return False
else:
print('/*\\ Ignored database migrations... /*\\')
return False
return True
def run_upgrade():