aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/Plot.py4
-rw-r--r--wqflask/utility/redis_tools.py20
-rw-r--r--wqflask/utility/startup_config.py6
3 files changed, 16 insertions, 14 deletions
diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py
index 9b2c6735..d4256a46 100644
--- a/wqflask/utility/Plot.py
+++ b/wqflask/utility/Plot.py
@@ -139,7 +139,7 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
max_D = max(data)
min_D = min(data)
# add by NL 06-20-2011: fix the error: when max_D is infinite, log function in detScale will go wrong
- if max_D == float('inf') or max_D > webqtlConfig.MAXLRS:
+ if (max_D == float('inf') or max_D > webqtlConfig.MAXLRS) and min_D < webqtlConfig.MAXLRS:
max_D = webqtlConfig.MAXLRS # maximum LRS value
xLow, xTop, stepX = detScale(min_D, max_D)
@@ -156,7 +156,7 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
j += step
for i, item in enumerate(data):
- if item == float('inf') or item > webqtlConfig.MAXLRS:
+ if (item == float('inf') or item > webqtlConfig.MAXLRS) and min_D < webqtlConfig.MAXLRS:
item = webqtlConfig.MAXLRS # maximum LRS value
j = int((item - xLow) / step)
Count[j] += 1
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py
index ff125bd2..de9dde46 100644
--- a/wqflask/utility/redis_tools.py
+++ b/wqflask/utility/redis_tools.py
@@ -127,22 +127,20 @@ def check_verification_code(code):
def get_user_groups(user_id):
- # ZS: Get the groups where a user is an admin or a member and
+ # Get the groups where a user is an admin or a member and
# return lists corresponding to those two sets of groups
- admin_group_ids = [] # ZS: Group IDs where user is an admin
- user_group_ids = [] # ZS: Group IDs where user is a regular user
+ admin_group_ids = [] # Group IDs where user is an admin
+ user_group_ids = [] # Group IDs where user is a regular user
groups_list = Redis.hgetall("groups")
- for key in groups_list:
+ for group_id, group_details in groups_list.items():
try:
- group_ob = json.loads(groups_list[key])
- group_admins = set([this_admin.encode(
- 'utf-8') if this_admin else None for this_admin in group_ob['admins']])
- group_members = set([this_member.encode(
- 'utf-8') if this_member else None for this_member in group_ob['members']])
+ _details = json.loads(group_details)
+ group_admins = set([this_admin if this_admin else None for this_admin in _details['admins']])
+ group_members = set([this_member if this_member else None for this_member in _details['members']])
if user_id in group_admins:
- admin_group_ids.append(group_ob['id'])
+ admin_group_ids.append(group_id)
elif user_id in group_members:
- user_group_ids.append(group_ob['id'])
+ user_group_ids.append(group_id)
else:
continue
except:
diff --git a/wqflask/utility/startup_config.py b/wqflask/utility/startup_config.py
index 56d0af6f..778fb64d 100644
--- a/wqflask/utility/startup_config.py
+++ b/wqflask/utility/startup_config.py
@@ -20,8 +20,12 @@ def app_config():
import os
app.config['SECRET_KEY'] = str(os.urandom(24))
mode = WEBSERVER_MODE
- if mode == "DEV" or mode == "DEBUG":
+ if mode in ["DEV", "DEBUG"]:
app.config['TEMPLATES_AUTO_RELOAD'] = True
+ if mode == "DEBUG":
+ from flask_debugtoolbar import DebugToolbarExtension
+ app.debug = True
+ toolbar = DebugToolbarExtension(app)
print("==========================================")