本文整理汇总了Python中pyramid.configuration.Configurator.testing_models方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.testing_models方法的具体用法?Python Configurator.testing_models怎么用?Python Configurator.testing_models使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.configuration.Configurator
的用法示例。
在下文中一共展示了Configurator.testing_models方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerModels
# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import testing_models [as 别名]
def registerModels(models):
""" Registers a dictionary of :term:`model` objects that can be
resolved via the :func:`pyramid.traversal.find_model` API.
The :func:`pyramid.traversal.find_model` API is called with a
path as one of its arguments. If the dictionary you register when
calling this method contains that path as a string key
(e.g. ``/foo/bar`` or ``foo/bar``), the corresponding value will
be returned to ``find_model`` (and thus to your code) when
:func:`pyramid.traversal.find_model` is called with an
equivalent path string or tuple.
.. warning:: This API is deprecated as of :app:`Pyramid` 1.0.
Instead use the
:meth:`pyramid.configuration.Configurator.testing_models`
method in your unit and integration tests.
"""
registry = get_current_registry()
config = Configurator(registry=registry)
return config.testing_models(models)