本文整理汇总了Python中pyramid.path.DottedNameResolver.get_package方法的典型用法代码示例。如果您正苦于以下问题:Python DottedNameResolver.get_package方法的具体用法?Python DottedNameResolver.get_package怎么用?Python DottedNameResolver.get_package使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.path.DottedNameResolver
的用法示例。
在下文中一共展示了DottedNameResolver.get_package方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_config
# 需要导入模块: from pyramid.path import DottedNameResolver [as 别名]
# 或者: from pyramid.path.DottedNameResolver import get_package [as 别名]
def to_config(cls, global_config, app_settings):
config_file = global_config.get('__file__')
settings = cls.load_settings_from_file(config_file)
settings.update(app_settings)
caller = caller_module()
resolver = DottedNameResolver(caller)
package = resolver.get_package()
config = Configurator(settings=settings, package=package)
return config
示例2: __init__
# 需要导入模块: from pyramid.path import DottedNameResolver [as 别名]
# 或者: from pyramid.path.DottedNameResolver import get_package [as 别名]
def __init__(
self,
registry=None,
package=None,
settings=None,
root_factory=None,
authentication_policy=None,
authorization_policy=None,
renderers=None,
debug_logger=None,
locale_negotiator=None,
request_factory=None,
response_factory=None,
default_permission=None,
session_factory=None,
default_view_mapper=None,
autocommit=False,
exceptionresponse_view=default_exceptionresponse_view,
route_prefix=None,
introspection=True,
root_package=None,
):
if package is None:
package = caller_package()
if root_package is None:
root_package = package
name_resolver = DottedNameResolver(package)
self.name_resolver = name_resolver
self.package_name = name_resolver.get_package_name()
self.package = name_resolver.get_package()
self.root_package = root_package
self.registry = registry
self.autocommit = autocommit
self.route_prefix = route_prefix
self.introspection = introspection
if registry is None:
registry = Registry(self.package_name)
self.registry = registry
self.setup_registry(
settings=settings,
root_factory=root_factory,
authentication_policy=authentication_policy,
authorization_policy=authorization_policy,
renderers=renderers,
debug_logger=debug_logger,
locale_negotiator=locale_negotiator,
request_factory=request_factory,
response_factory=response_factory,
default_permission=default_permission,
session_factory=session_factory,
default_view_mapper=default_view_mapper,
exceptionresponse_view=exceptionresponse_view,
)