"""This file implements two classes. User (to hold information about a
specific user, including their timestamp) and AllUsers (a Borg
[singleton] which hashes the names of all the users with their User
instances)"""
import borg,time
class User:
def __init__(self,session,name):
self.session = session
self.name = name
self.time = time.time()
class AllUsers (borg.Borg):
def __init__(self):
borg.Borg.__init__(self)
if not hasattr(self,'userdict'): # first instance, then
self.userdict = {}
def adduser(self,user):
self.userdict[user.name.lower()] = user
def deluser(self,user):
del(self.userdict[user.name.lower()])