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