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


Python X.responseDate方法代码示例

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


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

示例1: oai_error

# 需要导入模块: from invenio.utils.html import X [as 别名]
# 或者: from invenio.utils.html.X import responseDate [as 别名]
def oai_error(argd, errors):
    """
    Return a well-formatted OAI-PMH error
    """
    out = """<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/
         http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">"""
    out += X.responseDate()(get_utc_now())
    for error_code, error_msg in errors:
        assert(error_code in CFG_ERRORS)
        if error_code in ("badArgument", "badVerb"):
            out += X.request()(oai_get_request_url())
            break
    else:
        ## There are no badArgument or badVerb errors so we can
        ## return the whole request information
        out += X.request(**argd)(oai_get_request_url())
    for error_code, error_msg in errors:
        if error_msg is None:
            error_msg = CFG_ERRORS[error_code]
        else:
            error_msg = "%s %s" % (CFG_ERRORS[error_code], error_msg)
        out += X.error(code=error_code)(error_msg)
    out += "</OAI-PMH>"
    return out
开发者ID:mhellmic,项目名称:b2share,代码行数:29,代码来源:server.py

示例2: oai_build_request_element

# 需要导入模块: from invenio.utils.html import X [as 别名]
# 或者: from invenio.utils.html.X import responseDate [as 别名]
def oai_build_request_element(argd=None):
    """
    Build the request tag.
    """
    if argd is None:
        argd = {}
    return X.responseDate()(get_utc_now()) + X.request(**argd)("%s/oai2d" % CFG_SITE_URL or CFG_SITE_SECURE_URL)
开发者ID:mhellmic,项目名称:b2share,代码行数:9,代码来源:server.py

示例3: oai_header

# 需要导入模块: from invenio.utils.html import X [as 别名]
# 或者: from invenio.utils.html.X import responseDate [as 别名]
def oai_header(argd, verb):
    """
    Return OAI header
    """

    out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n"
    out += "<?xml-stylesheet type=\"text/xsl\" href=\"%s\" ?>\n" % (
        url_for('oairepository.static',
                filename='xsl/oairepository/oai2.xsl.v1.0'))
    out += "<OAI-PMH xmlns=\"http://www.openarchives.org/OAI/2.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\">\n"

    #out += "<responseDate>%s</responseDate>" % get_utc_now()
    out += X.responseDate()(get_utc_now())

    if verb:
        out += X.request(**argd)(oai_get_request_url())
        out += "<%s>\n" % verb
    else:
        out += X.request()(oai_get_request_url())

    return out
开发者ID:mhellmic,项目名称:b2share,代码行数:23,代码来源:server.py

示例4: oai_header

# 需要导入模块: from invenio.utils.html import X [as 别名]
# 或者: from invenio.utils.html.X import responseDate [as 别名]
def oai_header(argd, verb):
    """
    Return OAI header
    """

    out = '<?xml version="1.0" encoding="UTF-8"?>' + "\n"
    out += '<?xml-stylesheet type="text/xsl" href="%s" ?>\n' % (
        url_for("oairepository.static", filename="xsl/oairepository/oai2.xsl.v1.0")
    )
    out += '<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">\n'

    # out += "<responseDate>%s</responseDate>" % get_utc_now()
    out += X.responseDate()(get_utc_now())

    if verb:
        out += X.request(**argd)(oai_get_request_url())
        out += "<%s>\n" % verb
    else:
        out += X.request()(oai_get_request_url())

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


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