def configure(): """Configure the batch environment""" global apps # we suppose that the batch addresses only one application app_name, app = apps.items()[0] local.request = local.Process() local.worker = local.Process() log.set_logger('nagare.application.' + app.name) security.set_manager(app.security) # initialize the application context app.set_base_url('http://localhost/') # dummy server host app.set_locale(i18n.Locale('en', 'US')) # Set the default Locale # install the configuration registry.configure(app.configuration) # log the start of the script logger = log.get_logger('.' + __name__) logger.debug('----') logger.debug('Running %s\n' % sys.argv[0])
def setUp(self): # call the base implementation super(ConfigurationEnabledTestCase, self).setUp() # configure the local service local.request = local.Process() local.worker = local.Process() # read the configuration conf_path = test_resource_path('conf', 'eureka.cfg.template') defaults = dict(here='string(default="%s")' % os.path.abspath(os.path.dirname(conf_path))) conf = read_application_options(conf_path, self.fail, defaults) # initialize the application context # no root component since we only want to perform the configuration app = BaseApplication(None) app.PLATFORM = "Eureka base" app.set_config(conf_path, conf, self.fail) app.set_base_url('http://localhost/') # dummy server host app.set_locale(i18n.Locale('en', 'US')) # Set the default Locale # install the configuration registry.configure(app.configuration) # configure the security manager security.set_manager(app.security)
def setUp(self): # call the base implementation super(ConfigurationEnabledTestCase, self).setUp() # configure the local service local.request = local.Process() local.worker = local.Process() # read the configuration conf_path = test_resource_path('conf', 'eureka.cfg.template') defaults = dict( here='string(default="%s")' % os.path.abspath(os.path.dirname(conf_path)) ) conf = read_application_options(conf_path, self.fail, defaults) # initialize the application context # no root component since we only want to perform the configuration app = BaseApplication(None) app.PLATFORM = "Eureka base" app.set_config(conf_path, conf, self.fail) app.set_base_url('http://localhost/') # dummy server host app.set_locale(i18n.Locale('en', 'US')) # Set the default Locale # install the configuration registry.configure(app.configuration) # configure the security manager security.set_manager(app.security)
def tearDown(self): # clear the configuration registry.configure(None) # clear the local service local.request = None local.worker = None # call the base implementation super(ConfigurationEnabledTestCase, self).tearDown()
def tearDown(self): # Delete data files for dir_ in ('profile-thumbnails', 'profile-photo'): path = test_resource_path(dir_) for f in os.listdir(path): if f != 'EMPTY_DIR': p = os.path.join(path, f) if os.path.isdir(p): shutil.rmtree(os.path.join(path, f)) else: os.remove(p) # clear the configuration registry.configure(None) # clear the local service local.request = None local.worker = None # call the base implementation super(ConfigurationEnabledTestCase, self).tearDown()
def _install_singleton_services(self): registry.configure(self.configuration) event_management.set_manager(self.event_manager) flashmessage.set_handler(self.flash_handler)