Ejemplo n.º 1
0
    def __init__(self):

        if (config.logfile_name):
            if (config.logfile_append):
                flag = 'a'
            else:
                flag = 'w'

            self.logFile = open(config.logfile_name, flag)

        self.dbHandler = database.DatabaseWrapper(
            self, config.db_host, config.db_user, config.db_passwd,
            config.db_name, config.db_engine, config.db_charset)

        self.sessionHandler = session.SessionHandler(self)
        self.userHandler = session.users.UserHandler(self)
        self.matchHandler = game.match.MatchHandler(self)
Ejemplo n.º 2
0
    def __init__(self):

        if (config.logfile_name):
            if (config.logfile_append):
                flag = 'a'
            else:
                flag = 'w'

            self.logFile = open(config.logfile_name, flag)

        self.log("Initializing...")

        self.dbHandler = database.DatabaseWrapper(
            self, config.db_host, config.db_user, config.db_passwd,
            config.db_name, config.db_engine, config.db_charset)

        self.sessionHandler = session.SessionHandler(self)
        self.userHandler = session.users.UserHandler(self)
        self.matchHandler = game.match.MatchHandler(self)
        self.steamHandler = steam.SteamHandler(self)

        self.log("Started successfully")
Ejemplo n.º 3
0
    '''
    pwhash = hashlib.sha224(password)
    pwhash.update(settings.SECRET_KEY)
    return pwhash.hexdigest()


def filter_keys(src, blacklist):
    ''' filter_keys
    Helper function, removes the (key, value) pairs for keys in the blacklist
    list, returns filtered dictionary.
    '''
    for key in blacklist:
        if key in src:
            del src[key]

    return src


# Webapp initialization
import session
from .decorators import RPGFlask

# RPGFlask is in decorators and is just an extended version of flask.Flask
app = RPGFlask(__name__)
app.session_interface = session.SessionHandler()
app.jinja_env.line_statement_prefix = '%'
app.debug = settings.DEBUG
app.__version__ = __version__
# This just imports all of the webapps modules (defined in __all__)
map(lambda module: import_module("." + module, __name__), __all__)
Ejemplo n.º 4
0
        if _user.is_null:
            session.SessionHandler.inst.deluid(key)

        return _user

    def set_user(self, _user):

        key = session.SessionHandler.inst.setuid(_user.id)
        self.set_secure_cookie(RequestHandler.KEYNAME, str(key))


class MainHandler(RequestHandler):
    def get(self):
        _user = self.get_user()
        self.write(loader.load("index.html").generate(user=_user))


application = tornado.web.Application([
    (r"/", MainHandler),
    (r'/static/(.*)', tornado.web.StaticFileHandler, {
        'path': "./static/"
    }),
],
                                      cookie_secret=config.secure_cookie)

if __name__ == "__main__":
    application.listen(8888)
    user.UserHandler()
    session.SessionHandler()
    tornado.ioloop.IOLoop.current().start()
Ejemplo n.º 5
0
async def init_webserver(app, loop):
    connect(host=WEBSERVER.config.MONGO_URI)
    session.SessionHandler(WEBSERVER)
Ejemplo n.º 6
0
async def init_webserver(*_):
    """Initialisatie webserver and sessions"""
    connect(host=WEBSERVER.config.MONGO_URI)
    session.SessionHandler(WEBSERVER)