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


Python AppConfig.__init__方法代码示例

本文整理汇总了Python中tg.configuration.AppConfig.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.__init__方法的具体用法?Python AppConfig.__init__怎么用?Python AppConfig.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tg.configuration.AppConfig的用法示例。


在下文中一共展示了AppConfig.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import __init__ [as 别名]
    def __init__(self, folder, values=None):
        if values is None:
            values = {}
        AppConfig.__init__(self)

        # First we setup some base values that we know will work
        self.renderers = ["genshi", "mako", "jinja", "json", "jsonp", "kajiki"]
        self.render_functions = tg.util.Bunch()
        self.package = tests.test_stack
        self.default_renderer = "genshi"
        self.globals = self
        self.auth_backend = None
        self.auto_reload_templates = False
        self.use_legacy_renderer = False
        self.use_dotted_templatenames = False
        self.serve_static = False
        self["errorpage.enabled"] = False

        root = os.path.dirname(os.path.dirname(tests.__file__))
        test_base_path = os.path.join(root, "tests", "test_stack")
        test_config_path = os.path.join(test_base_path, folder)
        self.paths = tg.util.Bunch(
            root=test_base_path,
            controllers=os.path.join(test_config_path, "controllers"),
            static_files=os.path.join(test_config_path, "public"),
            templates=[os.path.join(test_config_path, "templates")],
            i18n=os.path.join(test_config_path, "i18n"),
        )

        # then we override those values with what was passed in
        for key, value in values.items():
            setattr(self, key, value)
开发者ID:TurboGears,项目名称:tg2,代码行数:34,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import __init__ [as 别名]
    def __init__(self, folder, values=None):
        if values is None:
            values = {}
        AppConfig.__init__(self)
        #First we setup some base values that we know will work
        self.renderers = ['genshi', 'mako', 'jinja','json']
        if not PY3:
            self.renderers.extend(['chameleon_genshi', 'kajiki'])

        self.render_functions = tg.util.Bunch()
        self.package = tests.test_stack
        self.default_renderer = 'genshi'
        self.globals = self
        self.auth_backend = None
        self.auto_reload_templates = False
        self.use_legacy_renderer = False
        self.use_dotted_templatenames = False
        self.serve_static = False

        root = os.path.dirname(os.path.dirname(tests.__file__))
        test_base_path = os.path.join(root,'tests', 'test_stack',)
        test_config_path = os.path.join(test_base_path, folder)
        self.paths=tg.util.Bunch(
                    root=test_base_path,
                    controllers=os.path.join(test_config_path, 'controllers'),
                    static_files=os.path.join(test_config_path, 'public'),
                    templates=[os.path.join(test_config_path, 'templates')],
                    i18n=os.path.join(test_config_path, 'i18n')
                    )
        # then we override those values with what was passed in
        for key, value in values.items():
            setattr(self, key, value)
开发者ID:Shamefox,项目名称:tg2,代码行数:34,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import __init__ [as 别名]
 def __init__(self, root_controller='root'):
     AppConfig.__init__(self)
     self.root_controller = root_controller
     self.package = allura
     self.renderers = ['json', 'genshi', 'mako', 'jinja']
     self.default_renderer = 'genshi'
     self.use_sqlalchemy = False
     self.use_toscawidgets = True
     self.use_transaction_manager = False
     self.handle_status_codes = [403, 404]
     self.disable_request_extensions = True
开发者ID:AsylumCorp,项目名称:incubator-allura,代码行数:13,代码来源:app_cfg.py

示例4: __init__

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import __init__ [as 别名]
    def __init__(self, root_controller=None):
        AppConfig.__init__(self, minimal=True, root_controller=root_controller)
        self.package = allura
        self.renderers = ['json', 'genshi', 'mako', 'jinja']
        self.default_renderer = 'jinja'
        self.register_rendering_engine(AlluraJinjaRenderer)
        self.use_sqlalchemy = False
        self.use_toscawidgets = False
        self.use_transaction_manager = False
        self.handle_status_codes = [403, 404]
        self.disable_request_extensions = True

        # if left to True (default) would use crank.util.default_path_translator to convert all URL punctuation to "_"
        # which is convenient for /foo-bar to execute a "def foo_bar" method, but is a pretty drastic change for us
        # and makes many URLs be valid that we might not want like /foo*bar /[email protected] /foo:bar
        self.dispatch_path_translator = None
开发者ID:apache,项目名称:allura,代码行数:18,代码来源:app_cfg.py

示例5: __init__

# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import __init__ [as 别名]
    def __init__(self):
        AppConfig.__init__(self)
        self.renderers = ['json', 'genshi', 'mako']
        tg.config['renderers'] = ['json', 'genshi', 'mako']
        self.render_functions = tg.util.Bunch()
        self.package = tests
        #self.default_renderer = 'genshi'
        self.globals = self
        self.helpers = {}
        self.auth_backend = None
        self.auto_reload_templates = False
        self.use_legacy_renderer = False
        self.use_dotted_templatenames = False
        self.use_sqlalchemy=True
        self.serve_static = False
        self.prefer_toscawidgets2 = True
        self['templating.genshi.name_constant_patch'] = True
        
        root = os.path.dirname(os.path.dirname(tests.__file__))
        test_base_path = os.path.join(root, 'tests')
        test_config_path = test_base_path #os.path.join(test_base_path, folder)
        self.paths=tg.util.Bunch(
                    root=test_base_path,
                    controllers=os.path.join(test_config_path, 'controllers'),
                    static_files=os.path.join(test_config_path, 'public'),
                    templates=[os.path.join(test_config_path, 'templates')],
                    i18n=os.path.join(test_config_path, 'i18n')
                    )
        

        #xxx: why not use memory db?
        values = {
            'sqlalchemy.url':'sqlite:///'+root+'/test.db',
            'session':tests.model.DBSession,
            'model':tests.model,
            'use_dotted_templatenames': True,
            'renderers': ['json', 'genshi', 'mako']
                  
        }
        
        #Then we overide those values with what was passed in
        for key, value in values.items():
            setattr(self, key, value)
开发者ID:TurboGears,项目名称:tgext.admin,代码行数:45,代码来源:t_config.py


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