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


Python DispatchState.resolve方法代码示例

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


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

示例1: test_call_twice

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
    def test_call_twice(self):
        req = MockRequest('/')
        state = DispatchState(req, self.dispatcher)
        state = state.resolve()

        try:
            state = state.resolve()
        except RuntimeError:
            assert state.method.__name__ == 'index', state.method
        else:
            assert False, 'Should have raised RuntimeError'
开发者ID:wegotpop,项目名称:crank,代码行数:13,代码来源:test_objectdispatcher.py

示例2: test_get_one

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_get_one(self):
     req = MockRequest('/asdf')
     state = DispatchState(req, self.dispatcher)
     state = state.resolve()
     assert state.method.__name__ == 'get_one'
     assert state.params == {}, state.params
     assert state.remainder == ['asdf'], state.remainder
开发者ID:TurboGears,项目名称:crank,代码行数:9,代码来源:test_restdispatcher.py

示例3: test_path_translation_args_skipped

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_path_translation_args_skipped(self):
     req = MockRequest('/with.args/para.meter1/para.meter2.json')
     state = DispatchState(req, mock_dispatcher_with_no_default_or_index, path_translator=True)
     state = state.resolve()
     assert state.method.__name__ == 'with_args', state.method
     assert 'para.meter1' in state.remainder, state.remainder
     assert 'para.meter2' in state.remainder, state.remainder
开发者ID:wegotpop,项目名称:crank,代码行数:9,代码来源:test_objectdispatcher.py

示例4: test_delete_hacky

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_delete_hacky(self):
     req = MockRequest('/asdf/sub', params={'_method':'delete'}, method='post')
     state = DispatchState(req, self.dispatcher)
     state = state.resolve()
     assert state.method.__name__ == 'post_delete', state.method
     assert state.controller.__class__.__name__ == 'MockDispatcher', state.controller
     assert state.params == {}, state.params
开发者ID:TurboGears,项目名称:crank,代码行数:9,代码来源:test_restdispatcher.py

示例5: test_rest_security_check_only_once

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_rest_security_check_only_once(self):
     req = MockRequest('/rest/25')
     state = DispatchState(req, self.dispatcher)
     state = state.resolve()
     assert state.controller.__class__.__name__ == 'rest', state.controller
     assert state.method.__name__ == 'get', state.method
     assert len(self.security_tracing) == 1, self.security_tracing
开发者ID:TurboGears,项目名称:crank,代码行数:9,代码来源:test_restdispatcher.py

示例6: test_controller_method_with_args_missing_args_index_disabled

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
    def test_controller_method_with_args_missing_args_index_disabled(self):
        req = MockRequest('/with_args/a')
        state = DispatchState(req, mock_dispatcher_with_index_with_argvars)

        try:
            mock_dispatcher_with_index_with_argvars._use_index_fallback = False
            state = state.resolve()
        finally:
            mock_dispatcher_with_index_with_argvars._use_index_fallback = True
开发者ID:wegotpop,项目名称:crank,代码行数:11,代码来源:test_objectdispatcher.py

示例7: test_path_translation_sub_controller

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
    def test_path_translation_sub_controller(self):
        req = MockRequest('/sub.child/with.args/para.meter1/para.meter2.json')
        state = DispatchState(req, mock_dispatcher_with_no_default, path_translator=True)
        state = state.resolve()

        path_pieces = [piece[0] for piece in state.controller_path]
        assert 'sub_child' in path_pieces
        assert state.method.__name__ == 'with_args', state.method
        assert 'para.meter1' in state.remainder, state.remainder
        assert 'para.meter2' in state.remainder, state.remainder
开发者ID:wegotpop,项目名称:crank,代码行数:12,代码来源:test_objectdispatcher.py

示例8: test_sub_dispatcher_override_dispatch

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_sub_dispatcher_override_dispatch(self):
     req = MockRequest('/override_dispatch', params={'a':1})
     state = DispatchState(req, self.dispatcher) 
     state = state.resolve()
     assert state.method.__name__ == 'wacky', state.method
开发者ID:wegotpop,项目名称:crank,代码行数:7,代码来源:test_objectdispatcher.py

示例9: test_sub_dispatcher_bad_remainder_call_parent_default

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_sub_dispatcher_bad_remainder_call_parent_default(self):
     req = MockRequest('/sub/a')
     state = DispatchState(req, self.dispatcher) 
     state = state.resolve()
     assert state.method.__name__ == '_default', state.method
开发者ID:wegotpop,项目名称:crank,代码行数:7,代码来源:test_objectdispatcher.py

示例10: test_sub_dispatcher_bad_params_call_parent_default

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_sub_dispatcher_bad_params_call_parent_default(self):
     req = MockRequest('/sub', params={'a':1})
     state = DispatchState(req, self.dispatcher) 
     state = state.resolve()
     assert state.method.__name__ == '_default', state.method
开发者ID:wegotpop,项目名称:crank,代码行数:7,代码来源:test_objectdispatcher.py

示例11: test_rest_with_lookup

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_rest_with_lookup(self):
     req = MockRequest('/rest/somethingelse/method')
     state = DispatchState(req, self.dispatcher)
     state = state.resolve()
     assert state.controller.__class__.__name__ == 'sub', state.controller
     assert state.method.__name__ == 'method', state.method
开发者ID:TurboGears,项目名称:crank,代码行数:8,代码来源:test_restdispatcher.py

示例12: test_sub_dispatcher

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_sub_dispatcher(self):
     req = MockRequest('/sub')
     state = DispatchState(req, self.dispatcher) 
     state = state.resolve()
     assert state.method.__name__ == 'index', state.method
     assert state.controller.__class__.__name__ == 'MockSubDispatcher', state.controller
开发者ID:wegotpop,项目名称:crank,代码行数:8,代码来源:test_objectdispatcher.py

示例13: test_path_translation_no_extension

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_path_translation_no_extension(self):
     req = MockRequest('/no.args')
     state = DispatchState(req, mock_dispatcher_with_no_default_or_index,
                           strip_extension=False, path_translator=True)
     state = state.resolve()
     assert state.method.__name__ == 'no_args', state.method
开发者ID:wegotpop,项目名称:crank,代码行数:8,代码来源:test_objectdispatcher.py

示例14: test_post_hacky

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_post_hacky(self):
     req = MockRequest('/', params={'_method':'custom'}, method='post')
     state = DispatchState(req, self.dispatcher)
     state = state.resolve()
     assert state.method.__name__ == 'post_custom', state.method
开发者ID:TurboGears,项目名称:crank,代码行数:7,代码来源:test_restdispatcher.py

示例15: test_get_url

# 需要导入模块: from crank.dispatchstate import DispatchState [as 别名]
# 或者: from crank.dispatchstate.DispatchState import resolve [as 别名]
 def test_get_url(self):
     req = MockRequest('/sub', params={'_method':'custom'}, method='get')
     state = DispatchState(req, self.dispatcher)
     state = state.resolve()
     assert state.method.__name__ == 'get_custom', state.method
开发者ID:TurboGears,项目名称:crank,代码行数:7,代码来源:test_restdispatcher.py


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