本文整理汇总了Python中config.Configuration.acknowledgements_url方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.acknowledgements_url方法的具体用法?Python Configuration.acknowledgements_url怎么用?Python Configuration.acknowledgements_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.Configuration
的用法示例。
在下文中一共展示了Configuration.acknowledgements_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_configuration_links
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import acknowledgements_url [as 别名]
def add_configuration_links(cls, feed):
for rel, value in (
("terms-of-service", Configuration.terms_of_service_url()),
("privacy-policy", Configuration.privacy_policy_url()),
("copyright", Configuration.acknowledgements_url()),
("about", Configuration.about_url()),
):
if value:
d = dict(href=value, type="text/html", rel=rel)
if isinstance(feed, OPDSFeed):
feed.add_link(**d)
else:
# This is an ElementTree object.
link = E.link(**d)
feed.append(link)
示例2: create_authentication_document
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import acknowledgements_url [as 别名]
def create_authentication_document(self):
"""Create the OPDS authentication document to be used when
there's a 401 error.
"""
base_opds_document = Configuration.base_opds_authentication_document()
auth_type = [OPDSAuthenticationDocument.BASIC_AUTH_FLOW]
custom_auth_types = {}
for provider in self.oauth_providers:
type = "http://librarysimplified.org/authtype/%s" % provider.NAME
custom_auth_types[type] = provider
auth_type.append(type)
circulation_manager_url = Configuration.integration_url(
Configuration.CIRCULATION_MANAGER_INTEGRATION, required=True)
scheme, netloc, path, parameters, query, fragment = (
urlparse.urlparse(circulation_manager_url))
opds_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, str(netloc)))
links = {}
for rel, value in (
("terms-of-service", Configuration.terms_of_service_url()),
("privacy-policy", Configuration.privacy_policy_url()),
("copyright", Configuration.acknowledgements_url()),
("about", Configuration.about_url()),
):
if value:
links[rel] = dict(href=value, type="text/html")
doc = OPDSAuthenticationDocument.fill_in(
base_opds_document, auth_type, unicode(_("Library")), opds_id, None, unicode(_("Barcode")),
unicode(_("PIN")), links=links
)
for type, provider in custom_auth_types.items():
provider_info = dict(
authenticate=provider.authenticate_url(),
)
doc[type] = provider_info
return json.dumps(doc)