def load_environment(global_conf, app_conf): """\ Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app( global_conf, app_conf, package='openspending.ui', paths=paths) config['routes.map'] = routing.make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) # SQLAlchemy engine = engine_from_config(config, 'openspending.db.') engine = construct_engine(engine) init_model(engine) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config)
def load_environment(global_conf, app_conf): """\ Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app(global_conf, app_conf, package='openspending.ui', paths=paths) config['routes.map'] = routing.make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) # SQLAlchemy engine = engine_from_config(config, 'openspending.db.') engine = construct_engine(engine) init_model(engine) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config)
def test_configure(self): config = h.Mock() config.get.side_effect = ['myurl', 'myuser', 'mypass'] solr.configure(config) h.assert_equal(solr.url, 'myurl') h.assert_equal(solr.http_user, 'myuser') h.assert_equal(solr.http_pass, 'mypass')
def test_configure(self): config = Mock() config.get.side_effect = ['myurl', 'myuser', 'mypass'] solr.configure(config) assert solr.url == 'myurl' assert solr.http_user == 'myuser' assert solr.http_pass == 'mypass'
def test_configure(self): config = Mock() config.get.side_effect = ['myurl', 'myuser', 'mypass'] solr.configure(config) assert solr.url == 'myurl' assert solr.http_user == 'myuser' assert solr.http_pass == 'mypass'
def test_configure(self): config = h.Mock() config.get.side_effect = ['myurl', 'myuser', 'mypass'] solr.configure(config) h.assert_equal(solr.url, 'myurl') h.assert_equal(solr.http_user, 'myuser') h.assert_equal(solr.http_pass, 'mypass')
def load_environment(global_conf, app_conf): """\ Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app(global_conf, app_conf, package='openspending.ui', paths=paths) plugins.load_all(config) # Allow plugins implementing IConfigurer to modify the config. for plugin in plugins.PluginImplementations(IConfigurer): plugin.configure(config) config['routes.map'] = routing.make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) # Translator (i18n) config['openspending.ui.translations'] = MultiDomainTranslator([config.get('lang', 'en')]) translator = Translator(config['openspending.ui.translations']) def template_loaded(template): translator.setup(template) # Create the Genshi TemplateLoader config['pylons.app_globals'].genshi_loader = TemplateLoader( search_path=paths['templates'], auto_reload=True, callback=template_loaded ) init_mongo(config) # Configure ckan import openspending.lib.ckan as ckan ckan.configure(config) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config) # Plugin configuration. for plugin in plugins.PluginImplementations(IConfigurable): plugin.configure(config)
def load_environment(global_conf, app_conf): """\ Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app(global_conf, app_conf, package='openspending.ui', paths=paths) config['routes.map'] = routing.make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) # Establish celery loader: from openspending.command import celery # Translator (i18n) config['openspending.ui.translations'] = MultiDomainTranslator([config.get('lang', 'en')]) translator = Translator(config['openspending.ui.translations']) def template_loaded(template): translator.setup(template) template_paths = [paths['templates'][0]] extra_template_paths = config.get('extra_template_paths', '') if extra_template_paths: # must be first for them to override defaults template_paths = extra_template_paths.split(',') + template_paths # Create the Genshi TemplateLoader config['pylons.app_globals'].genshi_loader = TemplateLoader( search_path=template_paths, auto_reload=True, callback=template_loaded ) # SQLAlchemy engine = engine_from_config(config, 'openspending.db.') engine = construct_engine(engine) init_model(engine) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config)
def load_environment(global_conf, app_conf): """Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app(global_conf, app_conf, package='openspending.etl.ui', paths=paths) config['routes.map'] = make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) ## redo template setup to use genshi.search_path (so remove std template setup) template_paths = [paths['templates'][0]] # Translator (i18n) config['openspending.etl.ui.translations'] = MultiDomainTranslator([config.get('lang', 'en')]) translator = Translator(config['openspending.etl.ui.translations']) def template_loaded(template): translator.setup(template) config['pylons.app_globals'].genshi_loader = TemplateLoader( template_paths, auto_reload=True, callback=template_loaded) # SQLAlchemy engine = engine_from_config(config, 'openspending.db.') engine = construct_engine(engine) init_model(engine) # Configure ckan import openspending.etl.importer.ckan as ckan ckan.configure(config) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config)
def load_environment(global_conf, app_conf): """\ Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app( global_conf, app_conf, package='openspending.ui', paths=paths) config['routes.map'] = routing.make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) # Establish celery loader # This must be done (even if it results in a pyflakes error) because # celery loading is done from openspending.command.celery.__init__.py # Fixing that loading is how you would fix the flakes error from openspending.command import celery # SQLAlchemy engine = engine_from_config(config, 'openspending.db.') engine = construct_engine(engine) init_model(engine) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config)
def load_environment(global_conf, app_conf): """\ Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), static_files=os.path.join(root, 'public'), templates=[os.path.join(root, 'templates')]) # Initialize config with the basic options config.init_app(global_conf, app_conf, package='openspending.ui', paths=paths) config['routes.map'] = routing.make_map() config['pylons.app_globals'] = app_globals.Globals() config['pylons.h'] = helpers # set log level in markdown markdown.logger.setLevel(logging.WARN) # Establish celery loader # This must be done (even if it results in a pyflakes error) because # celery loading is done from openspending.command.celery.__init__.py # Fixing that loading is how you would fix the flakes error from openspending.command import celery # SQLAlchemy engine = engine_from_config(config, 'openspending.db.') engine = construct_engine(engine) init_model(engine) # Configure Solr import openspending.lib.solr_util as solr solr.configure(config)
def test_configure_defaults(self): solr.configure() h.assert_equal(solr.url, 'http://localhost:8983/solr') h.assert_equal(solr.http_user, None) h.assert_equal(solr.http_pass, None)
def test_configure_defaults(self): solr.configure() assert solr.url == 'http://localhost:8983/solr' assert solr.http_user is None assert solr.http_pass is None
def test_configure_defaults(self): solr.configure() assert solr.url == 'http://localhost:8983/solr' assert solr.http_user is None assert solr.http_pass is None
def test_configure_defaults(self): solr.configure() h.assert_equal(solr.url, 'http://localhost:8983/solr') h.assert_equal(solr.http_user, None) h.assert_equal(solr.http_pass, None)