本文整理汇总了Python中framework.config.Config.load方法的典型用法代码示例。如果您正苦于以下问题:Python Config.load方法的具体用法?Python Config.load怎么用?Python Config.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类framework.config.Config
的用法示例。
在下文中一共展示了Config.load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from framework.config import Config [as 别名]
# 或者: from framework.config.Config import load [as 别名]
def setUp(self):
# HACK: We kept getting db.printing inexplicably set to True, so patch
# it to be False here.
_real_db_execute = web.db.DB._db_execute
def _db_execute(self, cur, sql_query):
self.printing = False
return _real_db_execute(self, cur, sql_query)
web.db.DB._db_execute = _db_execute
# Set the dev flag in Config to False.
Config.load()
Config.data['dev'] = False
# Set the debug flag to true, despite what is in the config file
web.config.debug = False
web.config.session_parameters['cookie_name'] = 'gam'
# TODO: Clean up this initialization
web.ctx.method = ''
web.ctx.path = ''
import StringIO
web.ctx.env = {'wsgi.input': StringIO.StringIO(),
'REQUEST_METHOD': ''}
# Set up the routes
app = web.application(main.ROUTES, globals())
# Grab a database connection
self.db = main.sessionDB()
# Initialize the session holder (I don't know what that is yet)
#main.SessionHolder.set(web.session.Session(app, web.session.DBStore(db, 'web_session')))
# Finally, create a test app
self.app = TestApp(app.wsgifunc())
示例2: test_load
# 需要导入模块: from framework.config import Config [as 别名]
# 或者: from framework.config.Config import load [as 别名]
def test_load(self):
"""
Test `load` method and that a config has been loaded.
"""
Config.load()
self.assertIsNotNone(Config.data)
self.assertIsInstance(Config.data, dict)
示例3: setUp
# 需要导入模块: from framework.config import Config [as 别名]
# 或者: from framework.config.Config import load [as 别名]
def setUp(self):
Config.load()
# Use the test_db, so that you don't blow stuff away.
db_config = Config.get('database')
if 'test_db' in db_config and db_config['test_db']:
db_config['db'] = db_config['test_db']
# Grab a database connection
self.db = main.sessionDB()
self.install_db_structure(self.db)
self.load_db_fixtures(self.db, *self.fixtures)
# HACK: We kept getting db.printing inexplicably set to True, so patch
# it to be False here.
_real_db_execute = web.db.DB._db_execute
def _db_execute(self, cur, sql_query):
self.printing = False
return _real_db_execute(self, cur, sql_query)
web.db.DB._db_execute = _db_execute
super(DbFixturesMixin, self).setUp()