當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。