當前位置: 首頁>>代碼示例>>Python>>正文


Python Config.scan方法代碼示例

本文整理匯總了Python中morepath.config.Config.scan方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.scan方法的具體用法?Python Config.scan怎麽用?Python Config.scan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在morepath.config.Config的用法示例。


在下文中一共展示了Config.scan方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_basic_json

# 需要導入模塊: from morepath.config import Config [as 別名]
# 或者: from morepath.config.Config import scan [as 別名]
def test_basic_json():
    setup()
    basic.app.clear()

    config = Config()
    config.scan(basic)
    config.commit()

    c = Client(basic.app, Response)

    response = c.get('/foo/json')

    assert response.data == '{"id": "foo"}'
開發者ID:kingel,項目名稱:morepath,代碼行數:15,代碼來源:test_directive.py

示例2: test_basic

# 需要導入模塊: from morepath.config import Config [as 別名]
# 或者: from morepath.config.Config import scan [as 別名]
def test_basic():
    setup()
    basic.app.clear()

    config = Config()
    config.scan(basic)
    config.commit()

    c = Client(basic.app, Response)

    response = c.get('/foo')

    assert response.data == 'The view for model: foo'

    response = c.get('/foo/link')
    assert response.data == 'foo'
開發者ID:kingel,項目名稱:morepath,代碼行數:18,代碼來源:test_directive.py

示例3: test_nested

# 需要導入模塊: from morepath.config import Config [as 別名]
# 或者: from morepath.config.Config import scan [as 別名]
def test_nested():
    setup()
    nested.outer_app.clear()
    nested.app.clear()

    config = Config()
    config.scan(nested)
    config.commit()

    c = Client(nested.outer_app, Response)

    response = c.get('/inner/foo')

    assert response.data == 'The view for model: foo'

    response = c.get('/inner/foo/link')
    assert response.data == 'inner/foo'
開發者ID:kingel,項目名稱:morepath,代碼行數:19,代碼來源:test_directive.py

示例4: test_basic_root

# 需要導入模塊: from morepath.config import Config [as 別名]
# 或者: from morepath.config.Config import scan [as 別名]
def test_basic_root():
    setup()
    basic.app.clear()

    config = Config()
    config.scan(basic)
    config.commit()

    c = Client(basic.app, Response)

    response = c.get('/')

    assert response.data == 'The root: ROOT'

    # @@ is to make sure we get the view, not the sub-model
    response = c.get('/@@link')
    assert response.data == ''
開發者ID:kingel,項目名稱:morepath,代碼行數:19,代碼來源:test_directive.py


注:本文中的morepath.config.Config.scan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。