Skip to content
Snippets Groups Projects
Commit f3b314c4 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Merge branch 'fix-linting' of gitlab.rc.uab.edu:louistw/self-reg-form into fix-linting

parents 701756a2 f25a8a45
No related branches found
No related tags found
No related merge requests found
"""
This python script conatins functions that talk with Flask frontend over socketio.
It has functions to join a unique room, creating an account and certifying an account.
"""
# run.py # run.py
# standard imports # standard imports
...@@ -28,6 +32,13 @@ socketio = SocketIO( ...@@ -28,6 +32,13 @@ socketio = SocketIO(
@socketio.on("join_room") @socketio.on("join_room")
def on_room(json): def on_room(json):
"""
This function creates a unique room/flask session id, and joins it
Input:
json: conatins config information for the flask session
Output:
Join the unique room.
"""
room = str(session["uid"]) room = str(session["uid"])
referrer = json["referrer"] referrer = json["referrer"]
join_room(room) join_room(room)
...@@ -37,6 +48,14 @@ def on_room(json): ...@@ -37,6 +48,14 @@ def on_room(json):
@socketio.on("request account") @socketio.on("request account")
def request_account(json, methods=["GET", "POST"]): def request_account(json, methods=["GET", "POST"]):
"""
This function is called by the Flask frontend on an account request.
Input:
json: This contains information needed for the user that needs to be created from the frontend.
methods: Defaults to ["GET", "POST"].
Output:
Send the json to Celery tasks file for account creation.
"""
print( print(
time.strftime("%m-%d-%Y_%H:%M:%S") time.strftime("%m-%d-%Y_%H:%M:%S")
+ "\tQueue request received: " + "\tQueue request received: "
...@@ -57,6 +76,14 @@ def request_account(json, methods=["GET", "POST"]): ...@@ -57,6 +76,14 @@ def request_account(json, methods=["GET", "POST"]):
@socketio.on("request certification") @socketio.on("request certification")
def certify_account(json, methods=["GET", "POST"]): def certify_account(json, methods=["GET", "POST"]):
"""
This function is called by the Flask frontend from self certification page.
Inputs:
json: Conatins information about the user that needs to be certified from the frontend.
methods: Defaults to ["GET", "POST"].
Outputs:
Send the json to Celery tasks file for user certification.
"""
print( print(
time.strftime("%m-%d-%Y_%H:%M:%S") time.strftime("%m-%d-%Y_%H:%M:%S")
+ "\tQueue request received: " + "\tQueue request received: "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment