<s> import os <EOL> runPath = os . path . dirname ( os . path . realpath ( __file__ ) ) <EOL> from flask . ext . login import UserMixin <EOL> from lib . Config import Configuration <EOL> import lib . DatabaseLayer as db <EOL> class UserNotFoundError ( Exception ) : <EOL> pass <EOL> class User ( UserMixin ) : <EOL> '''<STR_LIT>''' <EOL> if not Configuration . loginRequired ( ) : <EOL> USERS = { "<STR_LIT>" : "<STR_LIT>" } <EOL> else : <EOL> USERS = { } <EOL> for user in db . getUsers ( ) : <EOL> USERS [ user [ '<STR_LIT:username>' ] ] = user [ '<STR_LIT:password>' ] <EOL> def __init__ ( self , id ) : <EOL> if not id in self . USERS : <EOL> raise UserNotFoundError ( ) <EOL> self . id = id <EOL> self . password = self . USERS [ id ] <EOL> @ classmethod <EOL> def get ( self_class , id ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> return self_class ( id ) <EOL> except UserNotFoundError : <EOL> return None </s>
