def test_read_specified_file(): os.environ['XSSNOTIFIER_CONFIG'] = 'tests/test_config.ini' try: c = Config() assert c.getint('Test', 'integer') == 20 finally: del os.environ['XSSNOTIFIER_CONFIG']
def main(): config = Config() application = tornado.web.Application([ (r'/ws/', WSHandler), (r'/.*', MainHandler), ]) application.active_connections = ActiveConnections() application.listen(config.getint('Server', 'port')) tornado.ioloop.IOLoop.current().start()
class Client: def __init__(self): self.config = Config() def get_client(self): return pymongo.MongoClient(self.config.get("Database", "host"), self.config.getint("Database", "port")) def get_user_collection(self): return self.get_client().xssdb[USERDB] def get_message_collection(self): return self.get_client().xssdb[MESSAGEDB]