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


Python Configurable.from_argv方法代码示例

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


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

示例1: from_fs

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
 def from_fs(cls, fs):
     """Takes a path under ./fsfix using / as the path separator.
     """
     fs = os.sep.join(fs.split('/'))
     request = Request.from_wsgi(StubWSGIRequest(fs))
     c = Configurable.from_argv(['fsfix'])
     c.copy_configuration_to(request)
     request.fs = fs
     request.namespace = {}
     request.website = Stub()
     request.website.template_loader = Stub()
     return request
开发者ID:falstaff84,项目名称:aspen,代码行数:14,代码来源:__init__.py

示例2: from_fs

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
 def from_fs(cls, fs):
     """Takes a path under ./fsfix using / as the path separator.
     """
     fs = os.sep.join(fs.split(os.sep))
     request = Request.from_wsgi(StubWSGIRequest(fs))
     website = Configurable.from_argv(['--root', 'fsfix'])
     website.copy_configuration_to(request)
     request.root = join(dirname(__file__), 'fsfix')
     request.fs = fs
     request.namespace = {}
     request.website = website 
     request.website.template_loader = Stub()
     return request
开发者ID:jatr,项目名称:aspen,代码行数:15,代码来源:__init__.py

示例3: from_fs

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
 def from_fs(cls, fs, *a):
     """Takes a path under FSFIX using / as the path separator.
     """
     fs = os.sep.join(fs.split(os.sep))
     request = Request.from_wsgi(StubWSGIRequest(fs))
     website = Configurable.from_argv([ '--www_root', FSFIX
                                      , '--project_root', '.aspen'
                                       ] + list(a))
     request.www_root = os.path.join(os.path.dirname(__file__), FSFIX)
     request.fs = fs
     request.context = {}
     request.website = website 
     request._media_type = None
     return request
开发者ID:jarpineh,项目名称:aspen,代码行数:16,代码来源:__init__.py

示例4: test_cheese_example

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
def test_cheese_example():
    mk(('configure-aspen.py', """\
from aspen.renderers import Renderer, Factory

class Cheese(Renderer):
    def render_content(self, context):
        return self.compiled.replace("cheese", "CHEESE!!!!!!")

class CheeseFactory(Factory):
    Renderer = Cheese

website.renderer_factories['excited-about-cheese'] = CheeseFactory(website)
"""))
    website = Configurable.from_argv(["--project_root", FSFIX])
    make_renderer = website.renderer_factories['excited-about-cheese']
    render = make_renderer("", "I like cheese!")  # test specline elsewhere
    actual = render({})
    assert actual == "I like CHEESE!!!!!!!", actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:20,代码来源:test_rendering.py

示例5: __init__

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
 def __init__(self, path):
     self.path = Path(path)
     c = Configurable.from_argv(['fsfix'])
     c.copy_configuration_to(self)
开发者ID:geekbuntu,项目名称:aspen,代码行数:6,代码来源:test_gauntlet.py

示例6: test_that_a_renderer_factory_is_instantiable

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
def test_that_a_renderer_factory_is_instantiable():
    actual = TornadoFactory(Configurable.from_argv([])).__class__
    assert actual is TornadoFactory, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:5,代码来源:test_rendering.py

示例7: tornado_factory_factory

# 需要导入模块: from aspen.configuration import Configurable [as 别名]
# 或者: from aspen.configuration.Configurable import from_argv [as 别名]
def tornado_factory_factory(argv=None):
    if argv is None:
        argv = []
    return TornadoFactory(Configurable.from_argv(argv))
开发者ID:allisonmobley,项目名称:aspen,代码行数:6,代码来源:test_rendering.py


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