Skip to content

Commit f31e700

Browse files
committed
bug fixes in redis
1 parent 9810d9f commit f31e700

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

getwvkeys/redis.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
from getwvkeys import config, libraries
2323
from getwvkeys.models.Shared import db
24+
from getwvkeys.user import FlaskUser
2425
from getwvkeys.utils import OPCode
2526

2627

@@ -57,7 +58,7 @@ def redis_message_handler(self, msg):
5758
return
5859
with self.app.app_context():
5960
try:
60-
libraries.User.disable_user(db, user_id)
61+
FlaskUser.disable_user(db, user_id)
6162
self.publish_response(reply_to)
6263
except Exception as e:
6364
self.publish_error(reply_to, "Error disablng user {}: {}".format(user_id, e))
@@ -68,7 +69,7 @@ def redis_message_handler(self, msg):
6869
return
6970
with self.app.app_context():
7071
try:
71-
libraries.User.disable_users(db, user_ids)
72+
FlaskUser.disable_users(db, user_ids)
7273
self.publish_response(
7374
reply_to,
7475
)
@@ -81,7 +82,7 @@ def redis_message_handler(self, msg):
8182
return
8283
with self.app.app_context():
8384
try:
84-
libraries.User.enable_user(db, user_id)
85+
FlaskUser.enable_user(db, user_id)
8586
self.publish_response(
8687
reply_to,
8788
)
@@ -92,7 +93,7 @@ def redis_message_handler(self, msg):
9293
self.publish_response(reply_to, self.library.get_keycount())
9394
elif op == OPCode.USER_COUNT.value:
9495
with self.app.app_context():
95-
self.publish_response(reply_to, libraries.User.get_user_count())
96+
self.publish_response(reply_to, FlaskUser.get_user_count())
9697
elif op == OPCode.SEARCH.value:
9798
query = d.get("query")
9899
if not query:
@@ -114,7 +115,7 @@ def redis_message_handler(self, msg):
114115
return
115116
with self.app.app_context():
116117
try:
117-
user = libraries.User.get(db, user_id)
118+
user = FlaskUser.get(db, user_id)
118119
if not user:
119120
self.publish_error(reply_to, "User not found")
120121
return
@@ -133,7 +134,7 @@ def redis_message_handler(self, msg):
133134
elif op == OPCode.RESET_API_KEY.value:
134135
user_id = d.get("user_id")
135136
with self.app.app_context():
136-
user = libraries.User.get(db, user_id)
137+
user = FlaskUser.get(db, user_id)
137138
if not user:
138139
self.publish_error(reply_to, "User not found")
139140
return

0 commit comments

Comments
 (0)