def __init__(self, connection, database_path, public_store, queue_store, staticdirector, user_template_path=None): # Get the template environment self.template_env = util.get_jinja_env(user_template_path) # Set up storage systems self.public_store = public_store self.queue_store = queue_store # Set up database self.connection = connection self.db = connection[database_path] models.register_models(connection) # set up routing self.routing = routing.get_mapper() # set up staticdirector tool self.staticdirector = staticdirector # certain properties need to be accessed globally eg from # validators, etc, which might not access to the request # object. setup_globals(db_connection=connection, database=self.db, public_store=self.public_store, queue_store=self.queue_store)
def __init__(self, connection, database_path, public_store, queue_store, staticdirector, user_template_path=None): # Get the template environment self.template_env = util.get_jinja_env(user_template_path) # Set up storage systems self.public_store = public_store self.queue_store = queue_store # Set up database self.connection = connection self.db = connection[database_path] models.register_models(connection) # set up routing self.routing = routing.get_mapper() # set up staticdirector tool self.staticdirector = staticdirector # certain properties need to be accessed globally eg from # validators, etc, which might not access to the request # object. setup_globals( db_connection=connection, database=self.db, public_store=self.public_store, queue_store=self.queue_store)
def test_setup_globals(): mg_globals.setup_globals(db_connection='my favorite db_connection!', database='my favorite database!', public_store='my favorite public_store!', queue_store='my favorite queue_store!') assert mg_globals.db_connection == 'my favorite db_connection!' assert mg_globals.database == 'my favorite database!' assert mg_globals.public_store == 'my favorite public_store!' assert mg_globals.queue_store == 'my favorite queue_store!'
def test_setup_globals(): mg_globals.setup_globals( db_connection='my favorite db_connection!', database='my favorite database!', public_store='my favorite public_store!', queue_store='my favorite queue_store!') assert mg_globals.db_connection == 'my favorite db_connection!' assert mg_globals.database == 'my favorite database!' assert mg_globals.public_store == 'my favorite public_store!' assert mg_globals.queue_store == 'my favorite queue_store!'