Initialize the msg to None as we may not have msg available, when

current version, and latest released version is matching.
This commit is contained in:
Ashesh Vashi 2016-05-24 11:49:38 +05:30
parent 8a3a44ed25
commit 98fa93413d

View File

@ -427,14 +427,17 @@ class BrowserPluginModule(PgAdminModule):
def index(): def index():
"""Render and process the main browser window.""" """Render and process the main browser window."""
# Get the Gravatar # Get the Gravatar
Gravatar(current_app, Gravatar(
size=100, current_app,
rating='g', size=100,
default='retro', rating='g',
force_default=False, default='retro',
use_ssl=False, force_default=False,
base_url=None) use_ssl=False,
base_url=None
)
msg = None
# Get the current version info from the website, and flash a message if # Get the current version info from the website, and flash a message if
# the user is out of date, and the check is enabled. # the user is out of date, and the check is enabled.
if config.UPGRADE_CHECK_ENABLED: if config.UPGRADE_CHECK_ENABLED:
@ -447,7 +450,9 @@ def index():
# It stuck on rendering the browser.html, while working in the # It stuck on rendering the browser.html, while working in the
# broken network. # broken network.
response = urlreq.urlopen(url, data, 5) response = urlreq.urlopen(url, data, 5)
current_app.logger.debug('Version check HTTP response code: %d' % response.getcode()) current_app.logger.debug(
'Version check HTTP response code: %d' % response.getcode()
)
if response.getcode() == 200: if response.getcode() == 200:
data = json.load(response) data = json.load(response)
@ -455,13 +460,15 @@ def index():
except: except:
pass pass
if data != None: if data is not None:
if data['pgadmin4']['version'] != config.APP_VERSION: if data['pgadmin4']['version'] != config.APP_VERSION:
msg = render_template(MODULE_NAME + "/upgrade.html", msg = render_template(
current_version=config.APP_VERSION, MODULE_NAME + "/upgrade.html",
upgrade_version=data['pgadmin4']['version'], current_version=config.APP_VERSION,
product_name=config.APP_NAME, upgrade_version=data['pgadmin4']['version'],
download_url=data['pgadmin4']['download_url']) product_name=config.APP_NAME,
download_url=data['pgadmin4']['download_url']
)
flash(msg, 'warning') flash(msg, 'warning')