本文整理汇总了Python中pyramid.path.DottedNameResolver.from_settings方法的典型用法代码示例。如果您正苦于以下问题:Python DottedNameResolver.from_settings方法的具体用法?Python DottedNameResolver.from_settings怎么用?Python DottedNameResolver.from_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.path.DottedNameResolver
的用法示例。
在下文中一共展示了DottedNameResolver.from_settings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mailer_settings_factory
# 需要导入模块: from pyramid.path import DottedNameResolver [as 别名]
# 或者: from pyramid.path.DottedNameResolver import from_settings [as 别名]
def mailer_settings_factory(settings, prefix='photoapp.mailer.'):
"""Returns the correctly configured specific implementation
of an IMailer object based on settings.
The specific implementation is determined by the `type`
setting, currently:
smtp:
send mail from SMTP server
console:
print mail messages to stdout (does not send any mail)
`console` is the default type.
Args:
settings: dict of settings
prefix: specific prefix to find mailer-specific settings
Returns:
IMailer instance
"""
classname = settings.get(prefix + 'class',
'photoapp.mail.SMTP_Mailer')
mailer_cls = DottedNameResolver().resolve(classname)
return mailer_cls.from_settings(settings, prefix)