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


Python X.sampleIdentifier方法代码示例

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


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

示例1: oai_identify

# 需要导入模块: from invenio.utils.html import X [as 别名]
# 或者: from invenio.utils.html.X import sampleIdentifier [as 别名]
def oai_identify(argd):
    """Generates a response to oai_identify verb.

     script_url - *str* URL of the script used to access the
                  service. This is made necessary since the gateway
                  can be accessed either via /oai2d or /oai2d/ (or for
                  backward compatibility: oai2d.py or oai2d.py/), and
                  that the base URL must be returned in the Identify
                  response
    """

    out = X.repositoryName()(CFG_SITE_NAME)
    out += X.baseURL()(CFG_SITE_URL + "/oai2d")
    out += X.protocolVersion()("2.0")
    out += X.adminEmail()(CFG_SITE_SUPPORT_EMAIL)
    out += X.earliestDatestamp()(get_earliest_datestamp())
    out += X.deletedRecord()(CFG_OAI_DELETED_POLICY)
    out += X.granularity()("YYYY-MM-DDThh:mm:ssZ")
    if CFG_WEBSTYLE_HTTP_USE_COMPRESSION:
        out += X.compression()("deflate")
    out += X.description(
        """<oai-identifier xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier
                                       http://www.openarchives.org/OAI/2.0/oai-identifier.xsd">"""
        + X.scheme()("oai")
        + X.repositoryIdentifier()(CFG_OAI_ID_PREFIX)
        + X.delimiter()(":")
        + X.sampleIdentifier()(CFG_OAI_SAMPLE_IDENTIFIER)
        + """</oai-identifier>"""
    )
    out += CFG_OAI_IDENTIFY_DESCRIPTION % {"CFG_SITE_URL": EscapedXMLString(CFG_SITE_URL)}
    if CFG_OAI_FRIENDS:
        friends = """<friends xmlns="http://www.openarchives.org/OAI/2.0/friends/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/friends/
      http://www.openarchives.org/OAI/2.0/friends.xsd">"""
        for baseurl in CFG_OAI_FRIENDS:
            friends += X.baseURL()(baseurl)
        friends += """</friends>"""
        out += X.description(friends)

    out = oai_header(argd, "Identify") + out + oai_footer("Identify")

    return out
开发者ID:CharlotteIrisC,项目名称:invenio,代码行数:47,代码来源:server.py


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