-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from TheManWhoLikesToCode/TheManWhoLikesToCode…
…-patch-1 Fix Issue #11
- Loading branch information
Showing
13 changed files
with
213 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import uuid | ||
from blackboard_session import BlackboardSession | ||
|
||
class BlackboardSessionManager: | ||
def __init__(self): | ||
self.bb_sessions = {} | ||
self.user_session_map = {} | ||
|
||
def get_bb_session(self, username): | ||
if username not in self.user_session_map: | ||
session_id = str(uuid.uuid4()) # Generate a unique session ID | ||
self.user_session_map[username] = session_id | ||
# Store the session object | ||
self.bb_sessions[session_id] = BlackboardSession() | ||
|
||
return self.bb_sessions[self.user_session_map[username]] | ||
|
||
def put_bb_session(self, username, bb_session): | ||
session_id = self.user_session_map.get(username) | ||
if session_id: | ||
self.bb_sessions[session_id] = bb_session | ||
|
||
def retrieve_bb_session(self, username): | ||
session_id = self.user_session_map.get(username) | ||
if session_id: | ||
return self.bb_sessions.get(session_id) | ||
|
||
return None | ||
|
||
def delete_bb_session(self, username): | ||
session_id = self.user_session_map.get(username) | ||
if session_id: | ||
session_to_delete = self.bb_sessions.pop(session_id, None) | ||
if session_to_delete: | ||
del self.user_session_map[username] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
if env == 'dev': | ||
PORT = 5003 | ||
DEBUG = True | ||
DEBUG = False | ||
elif env == 'prod': | ||
PORT = 5001 | ||
DEBUG = False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.