当前位置: 首页>>代码示例>>Python>>正文


Python Config.load方法代码示例

本文整理汇总了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())
开发者ID:AltisCorp,项目名称:Change-By-Us,代码行数:37,代码来源:project_tests.py

示例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)
开发者ID:AltisCorp,项目名称:Change-By-Us,代码行数:10,代码来源:config-tests.py

示例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()
开发者ID:AltisCorp,项目名称:Change-By-Us,代码行数:24,代码来源:mixins.py


注:本文中的framework.config.Config.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。